amazon-archives / kinesis-storm-spout

Kinesis spout for Storm
Other
106 stars 64 forks source link

when I run this I get error "Exception in thread "main" java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentialsProvider" #8

Open samglo opened 9 years ago

samglo commented 9 years ago

I'm trying to run against a AWS Kinesis stream, and I've included my AWSCredentials.properties file in the same directory where sample.properties file is.

I've examined , reviewed packaged jar file and the file is present , exists in packaged jar file com/amazonaws/auth/AWSCredentialsProvider

I'm using Eclipse Java EE IDE for Web Developers to build "runnable jar file", packaging in all dependencies. Version: Kepler Service Release 2 Build id: 20140224-0627

Below is error message. Any and all replies are appreciated!!

Sam

ns-lang-2.5.jar:/opt/storm/lib/reflectasm-1.07-shaded.jar:/opt/storm/lib/jetty-util-6.1.26.jar:/opt/storm/lib/disruptor-2.10.1.jar:KinesisStormSpout14.jar:/opt/storm/conf:/opt/storm/bin -Dstorm.jar=KinesisStormSpout14.jar SampleTopology sample.properties RemoteMode Exception in thread "main" java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentialsProvider at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2570) at java.lang.Class.getMethod0(Class.java:2813) at java.lang.Class.getMethod(Class.java:1663) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Caused by: java.lang.ClassNotFoundException: com.amazonaws.auth.AWSCredentialsProvider at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 6 more [vagrant@supervisor1 shared]$ Exception in thread "main" java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentialsProvider

cfregly commented 9 years ago

looks like you're missing the AWS Java SDK which contains the following:

https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/auth/AWSCredentialsProvider.java

you can download the jar here: http://aws.amazon.com/sdk-for-java/

or integrate with a build dependency mgmt (if you switch over to that at some point) here: http://search.maven.org/#artifactdetails%7Ccom.amazonaws%7Caws-java-sdk%7C1.9.3%7Cjar

hope that helps!

-chris

samglo commented 9 years ago

Thanks Chris for reply and guidance.

I checked my KinesisStormSpout27.jar file package which I built with Eclipse, converted to Maven Java Project, loaded dedendencies, and I know and verified that this "missing" file is there in packaged jar , inside aws-java-sdk-1.7.13.jar

But I'm downloading what you sent and will add it to my project as external jar file then will re-export then try to execute it .

Thanks again,

Sam

On Tuesday, October 28, 2014 5:06 PM, Chris Fregly notifications@github.com wrote:

looks like you're missing the AWS Java SDK which contains the following: https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/auth/AWSCredentialsProvider.java you can download the jar here: http://aws.amazon.com/sdk-for-java/ or integrate with a build dependency mgmt (if you switch over to that at some point) here: http://search.maven.org/#artifactdetails%7Ccom.amazonaws%7Caws-java-sdk%7C1.9.3%7Cjar hope that helps! -chris — Reply to this email directly or view it on GitHub.

samglo commented 9 years ago

Hi Chris,

I added the Maven dependency but am still getting the same AWSCredentialsProvider missing error.

See attached doc with my Eclipse project screen shot below showing dependencies.

On Tuesday, October 28, 2014 5:17 PM, Sam Glover samglo@att.net wrote:

Thanks Chris for reply and guidance.

I checked my KinesisStormSpout27.jar file package which I built with Eclipse, converted to Maven Java Project, loaded dedendencies, and I know and verified that this "missing" file is there in packaged jar , inside aws-java-sdk-1.7.13.jar

But I'm downloading what you sent and will add it to my project as external jar file then will re-export then try to execute it .

Thanks again,

Sam

On Tuesday, October 28, 2014 5:06 PM, Chris Fregly notifications@github.com wrote:

looks like you're missing the AWS Java SDK which contains the following: https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/auth/AWSCredentialsProvider.java you can download the jar here: http://aws.amazon.com/sdk-for-java/ or integrate with a build dependency mgmt (if you switch over to that at some point) here: http://search.maven.org/#artifactdetails%7Ccom.amazonaws%7Caws-java-sdk%7C1.9.3%7Cjar hope that helps! -chris — Reply to this email directly or view it on GitHub.

cfregly commented 9 years ago

ah, gotcha. you're trying to create a runnable UberJar (aka Shaded jar), basically - a jar that contains its dependent jars - versus adding all dependent jars to the runtime classpath which is usually what i end up doing. admittedly, my approach is not optimal.

i personally haven't had much luck (or experience) creating those with Ecilpse, but i'm sure it's possible.

sorry i can't be of more help, but this definitely looks like an UberJar packaging problem. perhaps investigate "shaded jars" and other techniques for creating this from Maven exclusively - without eclipse?

here's the maven plugin you'll be using: http://maven.apache.org/plugins/maven-shade-plugin/

or try running your code as a Java application in Eclipse and it'll take care of all of this for you using the Maven plugin, etc? not sure if that's an option in this case.

samglo commented 9 years ago

Thanks again for your guidance. I'll try this now.

On Tuesday, October 28, 2014 7:06 PM, Chris Fregly notifications@github.com wrote:

ah, gotcha. you're trying to create a runnable UberJar (aka Shaded jar), basically - a jar that contains its dependent jars - versus adding all dependent jars to the runtime classpath which is usually what i end up doing. admittedly, my approach is not optimal. i personally haven't had much luck (or experience) creating those with Ecilpse, but i'm sure it's possible. sorry i can't be of more help, but this definitely looks like an UberJar packaging problem. perhaps investigate "shaded jars" and other techniques for creating this from Maven exclusively - without eclipse? here's the maven plugin you'll be using: http://maven.apache.org/plugins/maven-shade-plugin/
or try running your code as a Java application in Eclipse and it'll take care of all of this for you using the Maven plugin, etc? not sure if that's an option in this case. — Reply to this email directly or view it on GitHub.

nehavishnoi11 commented 8 years ago

Hey sam even i am also facing the same issue can you please tell me that what solution is worked for you?

vishwambhar commented 8 years ago

Did you try using shade plugin? This will create a single fat jar with all the dependencies.

java -cp target/.jar com.example.aws.App

`

org.apache.maven.plugins maven-shade-plugin 2.4.3 package shade false com.example.aws.App ${project.version} *:* META-INF/*.SF META-INF/*.DSA META-INF/*.RSA

`

SourceCipher commented 7 years ago

Have same crappy error, cant find the solution for the past 5 hours.. Its a shame people can't solve this..