File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 6662

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
It's not a secret anymore!