In my project I have to deploy 2 applications on the same instance of JBoss server. Both the applications have thier own hibernate archives using two different session factories.
Applications are deployed as ear on jboss-4.0.4.GA.
Application1 has the following components:
Application2 has a similar structure with its own hibernate archive.
The applications work fine when only one of them is deployed. But when we deploy the second application after the first one, pages that access the database in both applications break. I have listed the stack trace for some of the exceptions thrown.
1. Caused by: java.lang.IllegalStateException: The x.app1.module1.model.table1 Cache is not alive.
2. Caused by: java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken
This error happens when the page has to execute a named query. It happens the first time the page is accessed after being deployed and when we refresh the page, the page is rendered without error.
3. java.lang.LinkageError: loader constraints violated when linking com/common/model/BusinessException class
I get LinkageError when one of the application is undeployed.
I also notice that when jboss is restarted after deploying both applications, both the applications work fine without any error.
Can anyone please give me some suggestions to resolve this issue?