Details
-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
JBossAS-4.0.2 Final
-
None
Description
I have 2 ears. Each is using JBoss. The first contains a jar that represents the hibernate mapped objects and their DAO's. A second Jar that contains the business logic (POJO's) that handle transaction management, and then a WAR that utilizes the VO' s mapped by hibernate. The hibernate.cfg.xml file resides in the jar with the mapped objects. This is becuase the utility class that handles the creation of the session factory (and it's JNDI lookup) is bundled there. This app when deployed works fine.
A second EAR contains a jar that represents the mapped classes. A second jar that contains the stateless session bean, and the DAO's for the mapped value objects, and the hibernate.cfg.xml. That's all. This second EAR exists as the backend for a RMI connection that will be made by a thick SWT client deployed remotely.
What I am finding is that when I make the RMI call to the EJB deployed in EAR 2, it's utility class is finding and loading the hibernate.cfg.xml file from EAR 1.
Here is the method in the utility class that is getting the SessionFactory.
public static Session getHibernateSession() {
Session session = null;
SessionFactory sessionFactory = null;
try {
try
catch (NamingException e)
{ LOG.error("Unable to create the InitialContext"); }if (sessionFactory == null)
{ LOG.info("Session factory not found in JNDI. Creating new"); sessionFactory = new Configuration().configure().buildSessionFactory(); } session = sessionFactory.openSession();
} catch (HibernateException e)
return session;
}
Each app is configured with a differnet JNDI name, but the rest of the code is identical.
Both config files are named hibernate.cfg.xml, which shouldn't matter as they are deployed in different EAR's.
Both ears have the following entries in their jboss-app.xml files (in the EAR's META-INF folder)
EAR 1
<loader-repository>
com.corp.tls.ccl:loader=tls-ccl
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
EAR 2
<loader-repository>
com.crl.tls.dataentry:loader=tls-dataentry
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
According to the documenttation that I was pointed to when I reported this same error with the hibernate.properties file, this config entry should have completely isolated each EAR.
So, how am I getting a hibernate.cfg.xml from a different classloader? Is this a bug in JBoss? Does JBoss only allow 1 file name hibernate.cfg.xml to be deployed in a instance?
Attachments
Issue Links
- is related to
-
JBAS-2276 hibernate.properites being loaded across classloaders
- Closed