将代码上载到lambda时引发了此异常。我尝试了,但没有找到解决方案。
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.amazonaws.util.Md5Utils.md5AsBase64(Md5Utils.java:104)
at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1647)
at com.amazonaws.eclipse.lambda.upload.wizard.util.UploadFunctionUtil.performFunctionUpload(UploadFunctionUtil.java:95)
at com.amazonaws.eclipse.lambda.upload.wizard.UploadFunctionWizard.doFinish(UploadFunctionWizard.java:111)
at com.amazonaws.eclipse.core.plugin.AbstractAwsJobWizard$1.run(AbstractAwsJobWizard.java:35)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.amazonaws.eclipse.javasdk_1.11.248
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:508)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:419)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:411)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 6 more
2条答案
按热度按时间ktecyv1j1#
确保Eclipse运行在Java 8上。AWS Toolkit需要JAXB才能上传到AWS S3,但JAXB在Java 9和10中已弃用,并从Java 11中删除。如果您在Java 9、10或11下运行Eclipse,Eclipse/AWS Toolkit将找不到JAXB,并且您将收到此错误。
您可以通过指定Eclipse在启动时应使用的JVM来解决此问题。此处提供了有关各种平台的说明:https://wiki.eclipse.org/Eclipse.ini
svgewumm2#
另一个选择是将javax.xml.bind:jaxb-api添加到依赖项中