File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module" Watch "java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module" New topic
Author

java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module

Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6588
    
    1

I have the following dependency hierarcy on a project managed by maven



At runtime, the version picked by maven is 1.5.5. This is because it uses the nearest child strategy by default to pick the winner during a conflict. This creates the following error when I instantiate my spring bean on the server


<Truncated class names so we can focus on the problem>

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Blah' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [dao.Blah]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:288)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)


To avoid the error, I overrode the version on my webApp's pom.xml using the following configuration fragment.



I have 2 questions

1. Would you suggest this approach to resolve the conflict ? I do not have control over the jackson-core versions mentioned on Library X or jersey, so this seemed like a good choice.
2. Why would maven pick the nearest-version-to-the-root approach over the newest-version-of-a-jar approach by default ? As long as the major version of the jars are the same, should maven not pick that instead ? That seems to make more sense.


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module
 
Similar Threads
java.lang.NoClassDefFoundError: oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider
Maven dependencies won't download on my Mac
MAVEN2: Same dependency - other version on classpath
having trouble deploying "hello world" *.rar to jboss 4.2.3
maven release build error