JBoss Community

Re: How to stop my WAR loading JBoss's provided 3rd party classes?

created by Ales Justin in JBoss Microcontainer - View the full discussion
Caused by: 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)
at org.hibernate.cfg.Configuration.applyHibernateValidatorLegacyConstraintsOnDDL(Configuration.java:1651) [:3.6.0.Final]
at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1623) [:3.6.0.Final]
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1415) [:3.6.0.Final]
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345) [:3.6.0.Final]

Caused by: 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)

at org.hibernate.cfg.Configuration.applyHibernateValidatorLegacyConstraintsOnDDL(Configuration.java:1651) [:3.6.0.Final]

at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1623) [:3.6.0.Final]

at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1415) [:3.6.0.Final]

...

 

Note that I'm using JPA 2.0/Hibernate 3.6.0.Final. I have a fairly simple project - in my case, it's just a war. It's a stock JBoss 6.0.0.Final install - all I've done is put my war, together with an associated db-ds.xml file, into the server/default/deploy directory. I'm also using Spring 3.0.5.

 

Here's the relevant section of my project's pom.xml:

 

<dependency>

<groupId>org.hibernate</groupId>

<artifactId>hibernate-entitymanager</artifactId>

<version>3.6.0.Final</version>

<exclusions>

<exclusion>

<groupId>javax.transaction</groupId>

<artifactId>jta</artifactId>

</exclusion>

</exclusions>

</dependency>

 

I have also tried changing the scope of hibernate-entitymanager to "provided", in which case my project should be using JBoss 6's provided hibernate libraries, but when I do that I get this exception:

 

Caused by: java.lang.IncompatibleClassChangeError: Class org.hibernate.ejb.HibernatePersistence does not implement the requested interface javax.persistence.spi.PersistenceProvider

at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225) [:3.0.5.RELEASE]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308) [:3.0.5.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [:3.0.5.RELEASE]

Hmmm, how can this happen if both you and JBossAS use the same Hibernate version?

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community