Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

an internal error occurred during: uploading code to lambda

This exception is thrown while uploading code to lambda. I tried but no where found the solution.

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
like image 632
Rajan kumasr soni Avatar asked Oct 11 '18 10:10

Rajan kumasr soni


People also ask

How do I resolve the unable to import module error that I receive when I run Lambda code in Python?

This is because Lambda isn't prepackaged with all Python libraries. To resolve this error, create a deployment package or Lambda layer that includes the libraries that you want to use in your Python code for Lambda. Important: Make sure that you put the library that you import for Python inside the /python folder.


1 Answers

Make sure Eclipse is running with Java 8. AWS Toolkit requires JAXB for the upload to AWS S3, but JAXB was deprecated in Java 9 & 10, and removed from Java 11. If you're running Eclipse under Java 9, 10, or 11, Eclipse/AWS Toolkit won't find JAXB and you'll get this error.

You can resolve the problem by specifying the JVM Eclipse should use on startup. Instructions for various platforms found here: https://wiki.eclipse.org/Eclipse.ini

like image 112
dale peters Avatar answered Oct 15 '22 05:10

dale peters