Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
FPenco1666863018
Contributor II
Contributor II

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.AmazonS3Client

Hello everyone,

I am facing an issue with a Talend ESB 8.0.1 job that I have created. The job waits for a request via a tRESTRequest API, retrieves files from AWS S3, and then sends them to another API. Everything works correctly on my local machine: when I run the job and access http://localhost:8088/attachment, the job runs perfectly.

My JOB :

RTWrapperAttachmentToJSON_1.0.png

 

However, once deployed in the Runtime "deploy" folder and after sending the API request, I receive the following error: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.AmazonS3Client

javax.ws.rs.WebApplicationException: HTTP 500 Internal Server Error
        at rtwrapper.rtwrapperattachmenttojson_1_0.RTWrapperAttachmentToJSON$RestServiceProviderImpl4TalendJob.processRequest(RTWrapperAttachmentToJSON.java:1101)
        at rtwrapper.rtwrapperattachmenttojson_1_0.RTWrapperAttachmentToJSON$RestServiceProviderImpl4TalendJob.handleWrongRequest(RTWrapperAttachmentToJSON.java:1182)
        at rtwrapper.rtwrapperattachmenttojson_1_0.RTWrapperAttachmentToJSON$ExceptionMapper4TalendJobRestService.toResponse(RTWrapperAttachmentToJSON.java:1272)
        at org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper.toResponse(WebApplicationExceptionMapper.java:45)
        at org.apache.cxf.jaxrs.utils.ExceptionUtils.convertFaultToResponse(ExceptionUtils.java:85)
        at org.apache.cxf.jaxrs.utils.JAXRSUtils.convertFaultToResponse(JAXRSUtils.java:1718)
        at org.apache.cxf.jaxrs.JAXRSInvoker.handleFault(JAXRSInvoker.java:371)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:218)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247)
        at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:190)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.Server.handle(Server.java:516)
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:279)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.s3.AmazonS3Client
        at com.amazonaws.services.s3.AmazonS3Builder$1.apply(AmazonS3Builder.java:35)
        at com.amazonaws.services.s3.AmazonS3Builder$1.apply(AmazonS3Builder.java:32)
        at com.amazonaws.services.s3.AmazonS3ClientBuilder.build(AmazonS3ClientBuilder.java:64)
        at com.amazonaws.services.s3.AmazonS3ClientBuilder.build(AmazonS3ClientBuilder.java:28)
        at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
        at com.amazonaws.services.s3.AmazonS3ClientBuilder.defaultClient(AmazonS3ClientBuilder.java:54)
        at com.amazonaws.services.s3.transfer.TransferManagerBuilder.resolveS3Client(TransferManagerBuilder.java:121)
        at com.amazonaws.services.s3.transfer.TransferManagerBuilder.getParams(TransferManagerBuilder.java:435)
        at com.amazonaws.services.s3.transfer.TransferManagerBuilder.build(TransferManagerBuilder.java:447)
        at rtwrapper.rtwrapperattachmenttojson_1_0.RTWrapperAttachmentToJSON.tS3Get_1Process(RTWrapperAttachmentToJSON.java:4275)
        at rtwrapper.rtwrapperattachmenttojson_1_0.RTWrapperAttachmentToJSON.tRESTRequest_1_LoopProcess(RTWrapperAttachmentToJSON.java:12609)
        at rtwrapper.rtwrapperattachmenttojson_1_0.RTWrapperAttachmentToJSON$RestServiceProviderImpl4TalendJob.processRequest(RTWrapperAttachmentToJSON.java:1050)
        ... 38 more

To resolve this issue, I have already tried the following solutions without success:

  • Loading the aws-sdk-core and aws-sdk-s3 jars in the deploy folder.
  • Loading the files in a tLibraryLoad directly in the job, before the S3 connection in a prejob

Do you have any ideas or suggestions to solve this problem? Any help would be greatly appreciated.

Thank you in advance!

Best regards,

Labels (1)
  • v8.x

1 Solution

Accepted Solutions
FPenco1666863018
Contributor II
Contributor II
Author

After researching and testing

Java version was the same

I had to load these files into my deploy to make AWS S3 work:

FPenco1666863018_0-1716901783611.png

 

View solution in original post

4 Replies
Shicong_Hong
Employee
Employee

Hello 

Check the Java version on Runtime server, do you have different Java versions locally and on the Runtime server. See this similar post, there was a known issue with the AWS SDK and Java 8.

Regards

Shicong

jeoste
Creator II
Creator II

This error occurs because the version of your aws skd ore and s3 are not compatible between your runtime and your job.

"Loading into the deploy folder" did you install directly to the karaf the different .jar too ?

Try this command into the Karaf (runtime/bin folder)

bundle:install -s wrap:file:/opt/TalendRuntime-8.0.1-R2022-10-RT/runtime/jar/aws-java-sdk-core-1.12.315.jar
You might have to restart the karaf + delete and redeploy the task from TMC

Once done, the tLibraryLoad is not mandatory anymore

FPenco1666863018
Contributor II
Contributor II
Author

After researching and testing

Java version was the same

I had to load these files into my deploy to make AWS S3 work:

FPenco1666863018_0-1716901783611.png

 

Shicong_Hong
Employee
Employee

Great! Thanks for your feedback and sharing the solution with the community.