I use DAO's and the _BaseRootDAO class created by HibernateSynchronizer3. I coded HibernateSessionFactory, and the mapping file hibernate.cfg.xml is in the classpath.
Hibernate version: 3.0.5
Mapping documents: /hibernate.cfg.xml in the classpath
Code between sessionFactory.openSession() and session.close():
Code:
_RootDAO.initialize();
leGerant = fr.integrance.hibernate.dao.GerantsDAO.getInstance().getGerantByLogin(login);
Full stack trace of any exception that occurs:Code:
java.lang.RuntimeException: The session factory has not been initialized (or an error occured during initialization)
at fr.integrance.hibernate._BaseRootDAO.getSessionFactory(_BaseRootDAO.java:104)
at fr.integrance.hibernate._BaseRootDAO.getSession(_BaseRootDAO.java:155)
at fr.integrance.hibernate._BaseRootDAO.getSession(_BaseRootDAO.java:126)
at fr.integrance.hibernate._BaseRootDAO.get(_BaseRootDAO.java:260)
at fr.integrance.modele.gerants.base.BaseGerantsDAO.get(BaseGerantsDAO.java:44)
at fr.integrance.modele.gerants.Gerant.<init>(Gerant.java:79)
at fr.integrance.struts.action.LoginAction.execute(LoginAction.java:60)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
What's more, I don't understand how _BaseRootDAO can find the session factory calss (usually HibernateUtil or HibernateSessionFactory). Would it be possible to have a clue on that?
Is it useful to put the factory class name in the config file ?
Code:
<session-factory name="fr.integrance.hibernate.HibernateSessionFactory">