Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.1
Mapping documents:
hibernate-service.xml
Code:
<server>
<mbean code="org.jboss.hibernate.jmx.Hibernate"
name="jboss.har:service=Hibernate">
<attribute name="DatasourceName">java:/ClusterFNACDS</attribute>
<attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute>
<attribute name="SessionFactoryName">java:hibernate/SessionFactory</attribute>
<attribute name="CacheProviderClass">
org.hibernate.cache.HashtableCacheProvider
</attribute>
<!-- <attribute name="Hbm2ddlAuto">create-drop</attribute> -->
</mbean>
</server>
jboss-web.xmlCode:
<jboss-web>
<context-root>/intranet</context-root>
<resource-ref>
<res-ref-name>jdbc/HibernateFNAC</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>/ClusterFNACDS</jndi-name>
</resource-ref>
</jboss-web>
web.xmlCode:
<resource-ref>
<res-ref-name>jdbc/HibernateFNAC</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
Code between sessionFactory.openSession() and session.close():Code:
public void sessionCreated(HttpSessionEvent evt) {
logListener.info("Nueva Sesión: " + evt.getSession().getId());
TomcatConfig tomcat = new TomcatConfigHome().findById(1);
System.out.println(tomcat.getProperty() + "-" + tomcat.getValue());
Session hsession = null;
try {
InitialContext ctx = new InitialContext();
SessionFactory factory = (SessionFactory)ctx.lookup("java:hibernate/SessionFactory");
hsession = factory.openSession();
System.out.println("SESION HIBERNATE: " + hsession );
} catch (NamingException e1) {
e1.printStackTrace();
}
}
Full stack trace of any exception that occurs:Code:
17:50:39,281 INFO [SettingsFactory] Default entity-mode: pojo
17:50:39,281 INFO [SessionFactoryImpl] building session factory
17:50:41,671 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
17:50:41,671 INFO [NamingHelper] JNDI InitialContext properties:{}
17:50:41,734 INFO [Hibernate] SessionFactory successfully built and bound into JNDI [java:hibernate/SessionFactory]
17:50:41,781 INFO [TomcatDeployer] deploy, ctxPath=/intranet, warUrl=.../tmp/deploy/tmp24901intranet.ear-contents/intranetWEB-exp.war/
17:50:42,484 INFO [ClusterFNACSessionListener] LOG4J: Intranet ClusterFNAC context is created.
17:50:42,578 INFO [JBossCacheManager] init(): replicationGranularity_ is 0 and invaldateSessionPolicy is 2
17:50:42,578 ERROR [JBossCacheManager] JBossCacheService to Tomcat clustering not found
17:50:42,578 ERROR [TomcatDeployer] Failed to setup clustering, clustering disabled
17:50:42,656 INFO [EARDeployer] Started J2EE application: file:/C:/jboss/server/default/deploy/intranet.ear
17:53:21,015 INFO [ClusterFNACSessionListener] Nueva Sesión: 8FA548D3F4818277889FE726590A74B5
17:53:21,062 WARN [SessionFactoryObjectFactory] Not found: 9ce488ed0a654cd4010a65993b07000c
17:53:40,125 ERROR [TomcatConfigHome] get failed
java.lang.NullPointerException
at clusterFNAC.hibernate.TomcatConfigHome.findById(TomcatConfigHome.java:100)
at clusterFNAC.listeners.ClusterFNACSessionListener.sessionCreated(ClusterFNACSessionListener.java:21)
at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:389)
at org.apache.catalina.session.StandardSession.setId(StandardSession.java:361)
at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:825)
at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:290)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2215)
at org.apache.catalina.connector.Request.getSession(Request.java:2024)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:831)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:842)
at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:148)
at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:123)
at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:104)
at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:61)
at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:33)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
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.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
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:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Unknown Source)
17:53:42,062 ERROR [[/intranet]] Session event listener threw exception
java.lang.NullPointerException
at clusterFNAC.hibernate.TomcatConfigHome.findById(TomcatConfigHome.java:100)
at clusterFNAC.listeners.ClusterFNACSessionListener.sessionCreated(ClusterFNACSessionListener.java:21)
at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:389)
at org.apache.catalina.session.StandardSession.setId(StandardSession.java:361)
at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:825)
at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:290)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2215)
at org.apache.catalina.connector.Request.getSession(Request.java:2024)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:831)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:842)
at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:148)
at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:123)
at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:104)
at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:61)
at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:33)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
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.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
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:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Unknown Source)
Name and version of the database you are using:
PostgreSQL 8.0.1
Why could be the problem that make with this configuration not bingind factory into SessionFactoryObjectFactory class but then Hibernate do it some lines before, but it doens't work?.
Thanks All