Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
230 views
in Technique[技术] by (71.8m points)

java - JBoss and different versions of Hibernate

We are using JBoss 4.2.3 which in turn comes with version 3.2.1.ga of Hibernate. I would like to use Hibernate 3.5.1-FINAL which supports JPA 2.0. I've been trying to make this work by putting my own hibernate jars in my WEB-INF/lib folder and creating my own classloader for my WAR in jboss-web.xml

<jboss-web>
   <loader-repository> 
      com.moo.foo:archive=catalog-archive 
   </loader-repository> 
</jboss-web> 

I've also tried:

<jboss-web>
 <class-loading java2ClassLoadingCompliance="false">
  <loader-repository>
     com.moo.catalog:loader=catalogLoader
     <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
  </loader-repository>
 </class-loading>
</jboss-web>

But I get loads of various issues and this is the exception I'm currently stuck on:

Caused by: 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)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getDeclaredConstructor(Unknown Source)
    at org.hibernate.cfg.AnnotationConfiguration.applyHibernateValidatorLegacyConstraintsOnDDL(AnnotationConfiguration.java:443)

Since the deadline is looming I thought I'd better ask if it is even possible? :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Maybe too late, but it may help somebody that finds this thread looking for the problem described above about 'Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator....':

I'm using Jboss 4.2, Hibernate Core 3.6.5, Hibernate Validator 4.1.0, using maven, and I have the same problem. Finally I've solved it adding also this dependency:

    <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-validator-legacy</artifactId>
          <version>4.0.2.GA</version>
    </dependency>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...