struts_jdon_hibernate项目运行错误

10-05-05 yxh1122
在配置struts_jdon_hibernate项目在jboss中运行时,出现错误,

在sample.service.UserServiceImp的getModels等访问数据库的方法时出现错误,调试发现,运行到ThreadLocalSessionProvider类的

sess = getFactory().openSession();时,sess为空值,此时该类的_factory变量也为null,不知是不是hibernate配置的问题,详细错误信息如下:

11:01:12,343 INFO [STDOUT] 2010-05-05 11:01:12,343 [http-127.0.0.1-8080-1] DEBU

G com.jdon.aop.reflection.MethodInvokerUtil - [JdonFramework] method invoke: sam

ple.service.UserServiceImp method=getDepts

11:17:08,625 ERROR [STDERR] java.lang.NullPointerException

11:17:08,625 ERROR [STDERR] at com.jdon.persistence.hibernate.util.ThreadLocalSessionProvider.getSession(ThreadLocalSessionProvider.java

:58)

11:17:08,625 ERROR [STDERR] at com.jdon.persistence.hibernate.HibernateTemplate.doHibernate(HibernateTemplate.java:72)

11:17:08,625 ERROR [STDERR] at com.jdon.persistence.hibernate.HibernateTemplate.find(HibernateTemplate.java:450)

11:17:08,625 ERROR [STDERR] at com.jdon.persistence.hibernate.HibernateTemplate.find(HibernateTemplate.java:442)

11:17:08,625 ERROR [STDERR] at sample.dao.JdbcDaoImp.getDepts(JdbcDaoImp.java:58)

11:17:08,625 ERROR [STDERR] at sample.service.UserServiceImp.getDepts(UserServiceImp.java:123)

11:17:08,625 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

11:17:08,625 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

11:17:08,625 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

11:17:08,625 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.reflection.MethodInvokerUtil.execute(MethodInvokerUtil.java:54)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.reflection.ProxyMethodInvocation.methodInvoke(ProxyMethodInvocation.java:108)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:76)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.interceptor.SessionContextInterceptor.invoke(SessionContextInterceptor.java:76)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:84)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.interceptor.StatefulInterceptor.invoke(StatefulInterceptor.java:82)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:84)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.interceptor.PoolInterceptor.invoke(PoolInterceptor.java:91)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:84)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:58)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:84)

11:17:08,625 ERROR [STDERR] at com.jdon.aop.AopClient.invoke(AopClient.java:95)

11:17:08,625 ERROR [STDERR] at com.jdon.bussinessproxy.dyncproxy.DynamicProxyWeaving.invoke(DynamicProxyWeaving.java:62)

11:17:08,625 ERROR [STDERR] at $Proxy157.getDepts(Unknown Source)

11:17:08,625 ERROR [STDERR] at sample.ps.DeptAction.execute(DeptAction.java:39)

11:17:08,625 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)

11:17:08,625 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)

11:17:08,625 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)

11:17:08,640 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)

11:17:08,640 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)

11:17:08,640 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

11:17:08,640 ERROR [STDERR] at com.jdon.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

11:17:08,640 ERROR [STDERR] at com.jdon.persistence.hibernate.CloseSessionInViewFilter.doFilter(CloseSessionInViewFilter.java:43)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

11:17:08,640 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

11:17:08,640 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

11:17:08,640 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

11:17:08,640 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve

.java:126)

11:17:08,640 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.

java:70)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

11:17:08,640 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

11:17:08,640 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

11:17:08,640 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)

11:17:08,640 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)

11:17:08,640 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

11:17:08,640 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)

banq
2010-05-05 11:40
好像是Hibernate session已经关闭。

yxh1122
2010-05-05 11:52
问题解决了,犯低级错误了,我没有将jdbc的驱动库配置正确

猜你喜欢