It appears that regardless of where I play my jboss-deployment-structure.xml document in my ear or the .war contained in my .ear file, Jboss is ignoring it when loading my application. I have attempted the following locations:
However, when I enable my application through the console, I see messages like this for all of the appropriate Hibernate classes:
13:16:48,992 TRACE [org.jboss.modules] (ServerService Thread Pool -- 101) Finding class org.hibernate.ejb.Ejb3Configuration from Module "org.jboss.logmanager:main" from local module loader @79a705d7 (roots:/myhome/jboss-as-7.2.0.Alpha1-SNAPSHOT/modules)
Using JBoss 7.2, HIbernate 3.2.6, and on CentOS 6.3.
The application isn't using JPA, it is using old Hibernate 3.2.6 annotations.
Even if your not using JPA, you should still post the TRACE output or a link to it (via something like http://pastie.org/). The output should give me an idea of what is wrong.
Also, show us a list of the files in your deployment (jar tf YourApp.ear). I'm guessing that AS7 thinks your deploying a JPA app (as if you have a persistence.xml file or some @PersistenceUnit/@PersistenceContext annotations).
Unfortunately, because of the highly proprietary nature of the, and the size, sharing it is not something I'm able to do. However, should I do a recursive grep for those annotations? Also, while my .war file doesn't contain a persistance.xml file, one of the libraries in the WEB-INF/lib directory does. This is what its structure looks like:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myDomainPU" transaction-type="RESOURCE_LOCAL">
<property name="hibernate.validator.autoregister_listeners" value="false"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<!--property name="hibernate.cache.use_query_cache" value="false"/-->
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<property name="hibernate.show_sql" value="false"/>
I also see a few places where @PersistenceContext is being used. However, the primary question, why doesn't JBoss exclude org.hibernate as defined in my jboss-deployment-structure.xml? Is there another way to turn it off so that only the older .jar files are used?
Scott, We did a small test application using @PersistenceContext, and persistance.xml along with a jboss-deployment-structure.xml document that is working. The difference is that myApp is an .ear file, not a .war. I wonder if that could be the issue?
Upgrading to Hibernate 4 would be ideal but other things that you could do:
- Remove the JPA section from the as7/standalone/configuration/standalone.xml file (disabling EE JPA).
- Change the application to not include EE JPA elements that the EE JPA subsystem sees during application deployment. The EE JPA subsystem will inject Hibernate 4 jars onto the application classpath if it sees the persistence.xml/JPA annotations.
Hey scott, I see this thread is a little old, but I removed all JPA elements from standalone.xml, but somehow hibernate-validator is still being injected to the classpath of my module. I wonder if I need to do anything else?
If your using the AS 7.x community version, you could upgrade to WildFly 8.x and post in the https://community.jboss.org/en/wildfly forums as I'm not sure exactly what problem your having (but best to try against the latest version and start a new discussion thread). You can mention this discussion thread if you hit the same issue as described above.