Try to deploy a web application using latest hibernate version to jboss4.2.3.GA
I am trying to deploy a web application using hibernate to Jboss 4.3.2.GA but I am receiving following error.
Invocation of init method failed; nested exception is
org.hibernate.AnnotationException:
java.lang.NoSuchMethodException:
org.hibernate.validator.ClassValidator.<init>(
java.lang.Class,
java.util.ResourceBundle,
org.hibernate.validator.MessageInterpolator,
java.util.Map,
org.hibernate.annotations.common.reflection.ReflectionManager)
I have a "jboss-web.xml" in /WEB-INF as
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<loader-repository>
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
</jboss-web>
but i am still having th开发者_开发百科e same error
I have added following dependencies and my problem is solved. Thanks to Hibernate guys, they provide us a legacy validator.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-legacy</artifactId>
<version>4.0.2.GA</version>
<exclusions>
<exclusion>
<artifactId>hibernate-commons-annotations</artifactId>
<groupId>org.hibernate</groupId>
</exclusion>
</exclusions>
</dependency>
Long story short. You can't use the latest Hibernate version (3.5+) with JBoss 4.2.3, as there is interference between Hibernate dependencies and EJB JARs in 4.2.3. You have 3 choices:
- Use the Hibernate which ships with 4.2.3 and doesn't interfere with the EJB JARs
- Use an earlier version of JBoss which doesn't have Hibernate (like 4.0.2)
- Use a later version of JBoss which has a newer version of Hibernate
精彩评论