views:

28

answers:

1

Looking for guidance as to what version of Spring, Hibernate and JBoss work together. I am currently using:

<dependencies>
    <dependency org="javax.servlet" name="jstl" rev="1.1.2" conf="runtime->default"/>
    <dependency org="org.springframework" name="spring" rev="2.5.6" conf="runtime->default"/>
    <dependency org="org.springframework" name="spring-webmvc" rev="2.5.6" conf="runtime->default"/>
    <dependency org="org.hibernate" name="hibernate-core" rev="3.5.6-Final" conf="runtime->default">
        <exclude module="xml-apis"/>
    </dependency>
    <dependency org="org.hibernate" name="hibernate-annotations" rev="3.5.6-Final" conf="runtime->master"/>
    <dependency org="commons-dbcp" name="commons-dbcp" rev="1.4" conf="runtime->default"/>        
    <dependency org="commons-lang" name="commons-lang" rev="2.5" conf="runtime->master"/>
    <dependency org="org.slf4j" name="slf4j-jdk14" rev="1.6.1" conf="runtime->default"/>
    <dependency org="org.slf4j" name="log4j-over-slf4j" rev="1.6.1" conf="runtime->default"/>
    <dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.6.1" conf="runtime->default"/>
    <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1" conf="runtime->default"/>
    <dependency org="log4j" name="log4j" rev="1.2.16" conf="runtime->default"/>

    <dependency org="taglibs" name="standard" rev="1.1.2" conf="runtime->default"/>

    <!-- exclude commons logging since we are using log4j-over-slf4j -->
    <exclude module="commons-logging" />

</dependencies>

And I get the following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/ecotrak-data.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider

+1  A: 

The class o.h.a.c.r.MetadataProvider is provided by hibernate-commons-annotations and the version I get transitively with Hibernate 3.5.6-Final is the version 3.2.0.Final. Just in case, here is a filtered dependency tree of a pet project:

$ mvn dependency:tree -Dincludes=org.hibernate:::
[INFO] Scanning for projects...
...
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ domain ---
[INFO] com.acme.samples.javaee6.domain:domain:jar:1.0-SNAPSHOT
[INFO] +- org.hibernate:hibernate-validator:jar:4.0.2.GA:runtime
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.5.6-Final:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
[INFO] |  \- org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
[INFO] |     \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] +- org.hibernate:hibernate-jpamodelgen:jar:1.1.0.CR1:compile
[INFO] \- org.hibernate:hibernate-ehcache:jar:3.5.6-Final:compile
[INFO] ------------------------------------------------------------------------
Pascal Thivent