Saturday, 8 March 2008

Spring + Hibernate

There are some packages that will be missing if you just copy sample code from the book "Manning.Spring.in.Action.2nd.Edition" when working with hibernate template

NoClassDefFoundError: javax/transaction/TransactionManager
you need jta.jar from springframework folder "lib/j2ee"

NoClassDefFoundError:org.hibernate.cfg.AnnotationConfiguration

value hibernate.dialect property is from http://www.hibernate.org/hib_docs/v3/api/org/hibernate/dialect/package-summary.html
depends on the database you are using, find the proper one. I am using PostgreSQL, so the value will be "org.hibernate.dialect.PostgreSQLDialect"



Basically to run hibernate in spring framework
the jars listed below are the necessary ones

my spring framework folder is C:\spring-framework-2.5.1-with-dependencies\
I will use springfolder for now

  • NoClassDefFoundError: javax/transaction/TransactionManager
  • springfolder\lib\j2ee\jta.jar
  • NoClassDefFoundError: org/hibernate/cfg/AnnotationConfiguration
  • springfolder\lib\hibernate\hibernate-annotations.jar
  • NoClassDefFoundError: org/dom4j/DocumentException
  • springfolder\lib\hibernate\hibernate3.jar
  • NoClassDefFoundError:org/hibernate/annotations/common/reflection/ReflectionManager
  • springfolder\lib\hibernate\hibernate-commons-annotations.jar
  • NoClassDefFoundError:javax/persistence/JoinTable
  • springfolder\lib\j2ee\persistence.jar
  • NoClassDefFoundError: org/apache/commons/collections/LRUMap
  • springfolder\lib\jakarta-commons\commons-collections.jar

No comments: