eclipse 在以下过程中发生内部错误:将代码上载到lambda

x0fgdtte  于 2022-11-04  发布在  Eclipse
关注(0)|答案(2)|浏览(153)

将代码上载到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
ktecyv1j

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

svgewumm

svgewumm2#

另一个选择是将javax.xml.bind:jaxb-api添加到依赖项中

<dependency>
     <groupId>javax.xml.bind</groupId>
     <artifactId>jaxb-api</artifactId>
     <version>2.3.1</version> 
</dependency>

相关问题