user1236196
user1236196

Reputation: 11

Dozer 5.3.2 issue NoClassDefFoundError

I am trying to upgrade from dozer 5.2.2 to 5.3.2, I am getting the following error

java.lang.NoClassDefFoundError: Could not initialize class org.dozer.DozerBeanMapper

It is there in the classpath and build.xml files, I just changed all references in my workspace from 5.2.2 to 5.3.2, I did similar thing while upgrading from 5.1 to 5.2.2, and it worked.

Any help is appreciated.

Thanks.

Upvotes: 0

Views: 7560

Answers (3)

razvanone
razvanone

Reputation: 1459

My dozer & dozer-spring version is 5.5.1.

Had the following error: "NoClassDefFoundError: org.dozer.stats.GlobalStatistics (initialization failure)". I was using commons-lang version 2.6 only in my dependencies.

Solved the problem by adding commons-lang3 dependency also. It is clear that there is a tight dependency in dozer on the version 3 of commons-lang library.

Upvotes: 1

Pau
Pau

Reputation: 813

5.3.2 is using org.slf4j.Logger: http://grepcode.com/file/repo1.maven.org/maven2/net.sf.dozer/dozer/5.3.2/org/dozer/DozerBeanMapper.java/

You are probably missing this library, which was not used in 5.2.2, where commons-logging were used: http://grepcode.com/file/repo1.maven.org/maven2/net.sf.dozer/dozer/5.2.2/org/dozer/DozerBeanMapper.java/

Upvotes: 1

Hadra
Hadra

Reputation: 41

I had the same problem, and actually, the only way I found is to use an older version of Dozer as you seem to do. We tried a bigger update (4.2 -> 5.3.2) than you. I precise that I only change the dependency in my pom.xml to make it work on my application server (WASCE), to resume:

Working:

<dependency>
   <groupId>net.sf.dozer</groupId>
   <artifactId>dozer</artifactId>
   <version>5.2.2</version>
</dependency>

Not working:

<dependency>
   <groupId>net.sf.dozer</groupId>
   <artifactId>dozer</artifactId>
   <version>5.3.2</version>
</dependency>

Even if we access to DozerBeanMapperSingletonWrapper :

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.dozer.DozerBeanMapper at org.dozer.DozerBeanMapperSingletonWrapper.getInstance(DozerBeanMapperSingletonWrapper.java:43)

The DozerBeanMapper constructor called is DozerBeanMapper(List mappingFiles), it could have been a bug inside. But the call to the simple constructor DozerBeanMapper() has the same result in our own classes.

Maybe a dependency is missing between the two versions... Note that there is no problem on Eclipse with 5.3.2 version, so it can also be a class loader problem...

Hope this will highlight the source of the problem.

Upvotes: 4

Related Questions