[jboss-user] [JBoss Microcontainer] - Re: How to stop my WAR loading JBoss's provided 3rd party classes?

Chris Council do-not-reply at jboss.com
Tue Jan 4 15:49:16 EST 2011


Chris Council [http://community.jboss.org/people/chriscouncil] created the discussion

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

To view the discussion, visit: http://community.jboss.org/message/578811#578811

--------------------------------------------------------------
So I'm having a similar issue to Petr, I'm getting the following exception when I try to start up JBoss with my war in the server/default/deploy directory:

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]
 

I have also tried removing the hibernate libraries from $JBOSS_HOME/common/lib, but then the server immediately halts with this exception:

> 13:37:45,775 INFO  [AbstractServer] Starting: JBossAS [6.0.0.Final "Neo"]
> 13:37:47,530 INFO  [ServerInfo] Java version: 1.6.0_22,Apple Inc.
> 13:37:47,530 INFO  [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
> 13:37:47,530 INFO  [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 17.1-b03-307,Apple Inc.
> 13:37:47,530 INFO  [ServerInfo] OS-System: Mac OS X 10.6.5,x86_64
> 13:37:47,531 INFO  [ServerInfo] VM arguments: -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dprogram.name=run.sh -Djava.library.path=/wdev/jboss-6.0.0.Final/bin/native/lib64 -Djava.endorsed.dirs=/wdev/jboss-6.0.0.Final/lib/endorsed 
> 13:37:47,620 INFO  [JMXKernel] Legacy JMX core initialized
> 13:37:52,790 ERROR [AbstractKernelController] Error installing to PreInstall: name=CEMFBuilder state=Real: java.lang.NoClassDefFoundError: javax/persistence/spi/PersistenceUnitInfo
>      at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_22]
>      at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_22]
>      at java.lang.Class.getDeclaredMethods(Class.java:1791) [:1.6.0_22]
> 

I've tried using this jboss-classloading-domain.xml in my WEB-INF directory, but it seems to have no effect:

> 
> 
> 
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> 
> 
> <classloading-domain xmlns="urn:jboss:classloading-domain:1.0"
> 
>      name="MyDomain">
> 
>      <parent-policy>
> 
>           <before-filter>
> 
>                <javabean xmlns="urn:jboss:javabean:2.0"
> 
>                     class="org.jboss.classloader.plugins.filter.NegatingClassFilter">
> 
>                     <constructor>
> 
>                          <parameter>
> 
>                               <javabean xmlns="urn:jboss:javabean:2.0"
> 
>                                    class="org.jboss.classloader.spi.filter.RecursivePackageClassFilter">
> 
>                                    <constructor>
> 
>                                         <parameter>org.hibernate</parameter>
> 
>                                    </constructor>
> 
>                               </javabean>
> 
>                          </parameter>
> 
>                     </constructor>
> 
>                </javabean>
> 
>           </before-filter>
> 
>      </parent-policy>
> 
> </classloading-domain>

I do get further when I remove *just* the hibernate-validator-legacy.jar from common/lib - but I really don't want to modify the stock JBoss installation. 

Any thoughts?

Thanks in advance.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/578811#578811]

Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110104/f5558568/attachment-0001.html 


More information about the jboss-user mailing list