3

Using this bundle - aws-java-sdk-osgi-1.11.26.jar in OSGI Server

Below Error is thrown when this is executed AmazonS3 s3 = new AmazonS3Client( credentials );

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration
        at com.amazonaws.ClientConfigurationFactory.getDefaultConfig(ClientConfigurationFactory.java:46)
        at com.amazonaws.ClientConfigurationFactory.getConfig(ClientConfigurationFactory.java:36)
        at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:440)

Any solution to fix this?

4 Answers 4

3

Thanks for all suggestions

The ClientConfiguration of aws-java-sdk-osgi-1.11.26.jar is dependent of Jackson-databind.jar Jackson-databind.jar is dependent on Jackson-core.jar So it is not able to initialize ClientConfiguration.

Added Import-Package importing all from jackson-core-osgi.jar in Manifest of Jackson-databind-osgi.jar

Then the issue is resolved

Note: All dependent jars are converted to OSGI jars and deployed

Sign up to request clarification or add additional context in comments.

1 Comment

How did you achieved that? I want to do similar thing with gradle.
1

Well, make sure that aws-java-sdk-osgi-1.11.26.jar is present on your classpath, because the class itself is present in the jar. I've just downloaded the jar.

aws-java-sdk-osgi-1.11.26.jar

Comments

0

I guess you are missing an Import-Package statement in your bundle Manifest. Not sure how you build your bundle but I would recommend to use bnd in some form for it. For example I typically use the maven-bundle-plugin which uses bnd under the hood. Bnd is able to figure out the imports automatically for most cases.

2 Comments

<build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <configuration> <obrRepository>NONE</obrRepository> <instructions> ... <Import-Package> com.amazonaws.*; javax.ws.rs.*, org.apache.http.entity, </Import-Package> <Service-Component>*</Service-Component> </instructions> </configuration> </plugin> </plugins> </build>
Can you try to remove the Import-Package statement. In most casses the default should do the right thing. Your setting will override the default of picking up all necessary packages .. maybe one is missing. On the other hand at least the import for com.amazonaws should be present with your config.
0

In my case, restarting the flink cluster solved the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.