寻找有关Spring,Hibernate和JBoss的哪个版本协同工作的指导。我目前正在使用:
<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>
我收到以下错误:
org.springframework.beans.factory.BeanCreationException:在ServletContext资源[/WEB-INF/ecotrak-data.xml]中定义了名为'sessionFactory'的bean创建错误:init方法的调用失败;嵌套异常是java.lang.NoClassDefFoundError:org / hibernate / annotations / common / reflection / MetadataProvider
答案 0 :(得分:4)
班级o.h.a.c.r.MetadataProvider
由hibernate-commons-annotations
提供,我通过Hibernate 3.5.6-Final
传递的版本是 3.2.0.Final
版本。以防万一,这是宠物项目的过滤依赖树:
$ 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] ------------------------------------------------------------------------