question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Packaging 4.0.0 no class def found

See original GitHub issue

After trying to upgrade to 4.0.0 I was hit by a few Class not found exceptions:

ClassNotFoundException: io.restassured.path.xml.mapper.factory.JAXBObjectMapperFactory
ClassNotFoundException: io.restassured.path.json.mapper.factory.GsonObjectMapperFactory
java.lang.NoClassDefFoundError: io/restassured/path/json/mapper/factory/JohnzonObjectMapperFactory
cannot access TypeRef

From the wiki I should only need this dependency:

testCompile 'io.rest-assured:rest-assured:4.0.0'

That doesn’t seem to be enough

I’ve made it work with:

  testCompile group: 'io.rest-assured', name: 'rest-assured', version: '4.0.0'
  testCompile group: 'io.rest-assured', name: 'rest-assured-common', version: '4.0.0'
  testCompile group: 'io.rest-assured', name: 'json-path', version: '4.0.0'
  testCompile group: 'io.rest-assured', name: 'xml-path', version: '4.0.0'

See: https://github.com/hmcts/draft-store/pull/293

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:26

github_iconTop GitHub Comments

3reactions
johanhalebycommented, May 16, 2019

Might have found the issue:

+--- io.rest-assured:rest-assured:4.0.0
|    +--- org.codehaus.groovy:groovy:2.5.6
|    +--- org.codehaus.groovy:groovy-xml:2.5.6
|    |    \--- org.codehaus.groovy:groovy:2.5.6
|    +--- org.apache.httpcomponents:httpclient:4.5.3 -> 4.5.8
|    |    +--- org.apache.httpcomponents:httpcore:4.4.11
|    |    \--- commons-codec:commons-codec:1.11
|    +--- org.apache.httpcomponents:httpmime:4.5.3 -> 4.5.8
|    |    \--- org.apache.httpcomponents:httpclient:4.5.8 (*)
|    +--- org.hamcrest:hamcrest-core:2.1 -> 1.3
|    +--- org.hamcrest:hamcrest-library:2.1 -> 1.3
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- org.ccil.cowan.tagsoup:tagsoup:1.2.1
|    +--- io.rest-assured:json-path:4.0.0 -> 3.1.1
|    |    +--- org.codehaus.groovy:groovy-json:2.4.12 -> 2.5.6
|    |    |    \--- org.codehaus.groovy:groovy:2.5.6
|    |    +--- org.codehaus.groovy:groovy:2.4.12 -> 2.5.6
|    |    \--- io.rest-assured:rest-assured-common:3.1.1
|    |         +--- org.codehaus.groovy:groovy:2.4.12 -> 2.5.6
|    |         \--- org.apache.commons:commons-lang3:3.4 -> 3.8.1
|    \--- io.rest-assured:xml-path:4.0.0 -> 3.1.1
|         +--- org.codehaus.groovy:groovy-xml:2.4.12 -> 2.5.6 (*)
|         +--- org.codehaus.groovy:groovy:2.4.12 -> 2.5.6
|         +--- io.rest-assured:rest-assured-common:3.1.1 (*)
|         +--- org.apache.commons:commons-lang3:3.4 -> 3.8.1
|         +--- org.ccil.cowan.tagsoup:tagsoup:1.2.1
|         \--- javax.xml.bind:jaxb-api:2.2.12 -> 2.3.1
|              \--- javax.activation:javax.activation-api:1.2.0

For some reason xml-path depends on the old version. Need to investigate, but know I have to pick-up kids from Kindergarten 😃

0reactions
redstone1994commented, Jun 10, 2019

Guys! Based on this link you can add a new dependency: rest-assured-all. It worked for me. https://github.com/rest-assured/rest-assured/wiki/GettingStarted#java-9

Simply add the following dependency and keep the rest-assured dependency.

<dependency>
   <groupId>io.rest-assured</groupId>
   <artifactId>rest-assured-all</artifactId>
   <version>4.0.0</version>
</dependency>

My scenario: multi-project (module on IntelliJ) with a backend (spring boot) and a test project (using rest-assured).

Spring Boot still using the 3.1.1 version of rest-assured on the last version (2.1.5.RELEASE). But I use JDK1.8

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I solve "java.lang.NoClassDefFoundError"?
Looking at your main class, it is not in a package (you would have package graphics; at the top). · You're listing where...
Read more >
java.lang.NoClassDefFoundError - DigitalOcean
java.lang.NoClassDefFoundError is runtime error thrown when a required class is not found in the classpath and hence JVM is unable to load it ......
Read more >
How to solve java.lang.NoClassDefFoundError - Java67
Problem: I was trying to run a HelloWorld program using Spring Boot when I got this error: Exception in thread "main" java.lang.
Read more >
NoClassDefFoundError when running my plugin from FIJI
Apparently this happens when the class is there during compilation but not run time. I do have the apache/commons/csv/CSVPrinter in my pom file:...
Read more >
POM Reference - Maven
Introduction. The POM 4.0.0 XSD and descriptor reference documentation ... When no packaging is declared, Maven assumes the packaging is the default: jar...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found