Ok... I have solved the problem above but now I have a new problem. I have 2 applications, 1 with an EJB to create a cached copy of the manager class. I shall call this application App A and the other application, a web app deployed in an ear fille, App B. App B uses the cached copy of the manager class in App A, so is dependent on App A for some functions.
After the server is started, when I run any page in App A before running a page in App B that requires info from App A, everything works fine but if I run that page in App B before App A, I will get an ExceptionInInitializerError, saying it is unable to located the hibernate.cfg.xml file. Thereafter, both apps throw the same error regardless of the page visited.
Somehow I think the session factory is loaded only once and the applications use the same session factory. Is there a way to make the session factory work within the application and not shared? My session factory is created the same way as in the reference documentation's HibernateUtil class (page 14). Layout for both apps are as follows:
App A:
hibernate.jar and required jar files are located in EAR file's APP-INF/lib folder. hibernate.cfg.xml is located in META-INF folder.
App B:
hibernate.jar and required jar files are located in the WAR file's WEB-INF/lib folder. hibernate.cfg.xml is located in WEB-INF/classes folder.
Anybody has any idea on how to solve this problem?
|