JBoss Community

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

created by Chris Council in JBoss Microcontainer - View the full discussion

 

So I did have a JPA jar (org.hibernate.java-persistence:jpa-api:2.0-cr-1) in my war, coming from a transitive dependency. After removing it (and the four hibernate jars hibernate-commons-annotations-3.2.0.Final.jar, hibernate-core-3.6.0.Final.jar, hibernate-entitymanager-3.6.0.Final.jar, hibernate-jpa-2.0-api-1.0.0.Final.jar), I got the following exception on startup:

 

Caused by: java.lang.IllegalArgumentException: Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext@1032284510{vfs:///wdev/jboss-6.0.0.Final/server/default/deploy/properties-webapp-0.0.1-SNAPSHOT.war}
at org.jboss.jpa.resolvers.BasePersistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(BasePersistenceUnitDependencyResolver.java:107) [:1.0.2-alpha-3]
at org.jboss.web.deployers.AbstractWarDeployer.deployWebModule(AbstractWarDeployer.java:793) [:6.0.0.Final

Caused by: java.lang.IllegalArgumentException: Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext@1032284510{vfs:///appserver/jboss-6.0.0.Final/server/default/deploy/my-webapp-0.0.1-SNAPSHOT.war}

at org.jboss.jpa.resolvers.BasePersistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(BasePersistenceUnitDependencyResolver.java:107) [:1.0.2-alpha-3]

at org.jboss.web.deployers.AbstractWarDeployer.deployWebModule(AbstractWarDeployer.java:793) [:6.0.0.Final]

So the only way I can get things to work right now is to have those four jars inside my war, and hibernate-validator-legacy.jar manually removed from common/lib.
Oh well. I don't really want to remove the hibernate jars from my war, because then it won't work on Glassfish and Jetty.
Any thoughts on why JBoss won't start up without the hibernate jars in common/lib? It seems like there could be problems if I upgrade the war to another version of Hibernate in the future, and if I'm going to be modifying common/lib anyway, maybe I should just remove Hibernate altogether... or alternatively, ensure that the version I want is in that directory.

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community