Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: com.amazonaws.services.s3.AmazonS3 #1063

Closed
marcingrzejszczak opened this issue Apr 2, 2020 · 3 comments
Closed
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@marcingrzejszczak
Copy link

When trying to make Spring Cloud Contract work with 4.0.8 version of Pact JVM Consumer, I get the following exception

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during instruction selection: java.lang.NoClassDefFoundError: com.amazonaws.services.s3.AmazonS3                                                       
                                                                                                                                                                     
java.lang.RuntimeException: java.lang.NoClassDefFoundError: com.amazonaws.services.s3.AmazonS3                                                                       
        at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1118)                                         
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1098)                                                           
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:640)                                                                    
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:618)                                                              
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:595)                                                                             
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:574)                                                                             
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                               
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                             
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                     
        at java.lang.reflect.Method.invoke(Method.java:498)                                                                                                          
        at org.codehaus.gmavenplus.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:213)   

When checking the dependencies I can see that I have a dependency on AmazonS3.

[INFO] +- au.com.dius:pact-jvm-consumer-java8:jar:4.0.8:compile
[INFO] |  \- au.com.dius:pact-jvm-consumer:jar:4.0.8:compile
[INFO] |     +- com.googlecode.java-diff-utils:diffutils:jar:1.3.0:compile
[INFO] |     +- dk.brics.automaton:automaton:jar:1.11-8:compile
[INFO] |     +- org.json:json:jar:20160212:compile
[INFO] |     +- io.netty:netty-handler:jar:4.1.48.Final:compile
[INFO] |     |  +- io.netty:netty-common:jar:4.1.48.Final:compile
[INFO] |     |  +- io.netty:netty-resolver:jar:4.1.48.Final:compile
[INFO] |     |  +- io.netty:netty-buffer:jar:4.1.48.Final:compile
[INFO] |     |  +- io.netty:netty-transport:jar:4.1.48.Final:compile
[INFO] |     |  \- io.netty:netty-codec:jar:4.1.48.Final:compile
[INFO] |     +- org.apache.httpcomponents:httpmime:jar:4.5.12:compile
[INFO] |     +- au.com.dius:pact-jvm-core-model:jar:4.0.8:compile
[INFO] |     |  +- com.github.zafarkhaja:java-semver:jar:0.9.0:compile
[INFO] |     |  +- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] |     |  +- com.github.mifmif:generex:jar:1.0.2:compile
[INFO] |     |  \- com.amazonaws:aws-java-sdk-s3:jar:1.11.587:runtime
[INFO] |     |     +- com.amazonaws:aws-java-sdk-kms:jar:1.11.587:runtime
[INFO] |     |     +- com.amazonaws:aws-java-sdk-core:jar:1.11.587:runtime
[INFO] |     |     |  +- software.amazon.ion:ion-java:jar:1.0.2:runtime
[INFO] |     |     |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.10.3:runtime
[INFO] |     |     |  \- joda-time:joda-time:jar:2.8.1:runtime
[INFO] |     |     \- com.amazonaws:jmespath-java:jar:1.11.587:runtime

Of course I don't use AmazonS3 at all. Can you mark this as optional or maybe I'm doing something wrong?

@marcingrzejszczak
Copy link
Author

As a workaround I need to explicitly pass the AWS dependency.

@uglyog
Copy link
Member

uglyog commented Apr 4, 2020

It shouldn't be loading that class if you are not using Amazon S3 as a source of pact files.

@uglyog uglyog added the bug Indicates an unexpected problem or unintended behavior label Apr 4, 2020
uglyog pushed a commit that referenced this issue Apr 4, 2020
@uglyog
Copy link
Member

uglyog commented Apr 5, 2020

Version 4.0.9 released.

@uglyog uglyog closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants