I recently blooged about a Hibernate Annotations bug that had been fixed in Hibernate Annotations 3.4.0, but not in 3.2.
While upgrading fixed this problem, I did have some problems with changing to Hibernate Annotations 3.4.
I tried downloading hibernate-annotations-3.4.0.GA.tar.gz and just swapping over the hibernate-annotations.jar file in my project. Seemed like a simple thing to do, however, using the new hibernate-annotations.jar file caused a new error:
Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
This problem is discussed at this post. It turns out that, in upgrading, I need also to include hibernate-commons-annotations.jar.
Then I got another problem that is due to the lack of the slf4j-api.jar:
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
After that, I decided I'd better trust the README.txt file that comes with hibernate-annotations-3.4.0 and pulled across a bunch of (I think) required libraries:
dom4j.jar
ejb3-persistence.jar
hibernate-core.jar
slf4j-api.jar
slf4j-log4j12.jar
which fixed one problem... but led to another new error:
Caused by: java.lang.NoSuchFieldError: TRACE
The problem here seems to be that I need log4j.jar to be of version 1.2.12 or higher. (I've got 1.2.11 - missed it by that much!)
Having upgraded to log4j-1.2.15 that fixed that problem - but, a new one was waiting for me:
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMapat org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)
I realized (following a bit of reading I probably should have done right at the start!) that I needed to upgrade not just the hibernate-annotations, but also the hibernate core packages themselves to be compatible with the new annotations.
I downloaded the hibernate-distribution-3.3.0.SP1-dist.tar.gz file (something I probably should have done right from the start).
With Hibernate and Hibernate Annotations both updated, everything worked just fine.
The Moral of the Story: Check the dependencies when you upgrade one part of a system and make sure you read the documentation!
Now... I won't make that mistake again (not a guarantee!)
Subscribe to:
Post Comments (Atom)
2 comments:
really thank you , i faced exactly what you faced in hibernate, you really helped me alot :) , i really appreciate that
thank you for your effort
Post a Comment