This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module" Watch "java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module" New topic

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

Deepak Bala

Joined: Feb 24, 2006
Posts: 6661

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

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 - More SCJP Mocks
I agree. Here's the link:
subject: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Module
Similar Threads
maven release build error
java.lang.NoClassDefFoundError: oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider
MAVEN2: Same dependency - other version on classpath
having trouble deploying "hello world" *.rar to jboss 4.2.3
Maven dependencies won't download on my Mac