当前位置: 技术问答>java相关
为什么我的jsp文件调用bean时总不稳定,有时出错,有时又不出错奇怪。
来源: 互联网 发布时间:2017-04-25
本文导语: 出错时就出如下错误,似乎是找不到那个bean,而此时如果重新启动tomcat3.2就又可以了,需要说明的是,我有几个jsp 文件需要调用一个相同的bean,可是这几个jsp文件又不在一个文件夹里,(已正确放在了与web-inf同级的不同的...
出错时就出如下错误,似乎是找不到那个bean,而此时如果重新启动tomcat3.2就又可以了,需要说明的是,我有几个jsp 文件需要调用一个相同的bean,可是这几个jsp文件又不在一个文件夹里,(已正确放在了与web-inf同级的不同的文件夹里)
有人遇到过这种情况么?帮我看看写了。
Error: 500
Location: /test/bbs/yanzheng_bbslist.jsp
Internal Servlet Error:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:461)
at bbs._0002fbbs_0002fyanzheng_0005fbbslist_0002ejspyanzheng_0005fbbslist_jsp_5._jspService(_0002fbbs_0002fyanzheng_0005fbbslist_0002ejspyanzheng_0005fbbslist_jsp_5.java:135)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:536)
Root cause:
java.lang.NullPointerException
at com.mysql.jdbc.Statement.executeQuery(Unknown Source)
at com.mysql.jdbc.jdbc2.Statement.executeQuery(Unknown Source)
at com.codestudio.sql.PoolManStatement.executeQuery(PoolManStatement.java:105)
at com.smartdot.standard.DBAction.executeQuery(DBAction.java:148)
at com.smartdot.standard.PublicUser.checkUser(PublicUser.java:34)
at bbs._0002fbbs_0002fyanzheng_0005fbbslist_0002ejspyanzheng_0005fbbslist_jsp_5._jspService(_0002fbbs_0002fyanzheng_0005fbbslist_0002ejspyanzheng_0005fbbslist_jsp_5.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:536)
|
太长了,看得眼花啊.
原因可能是:你建立的数据池连接用完了,而你用完了连接没有去释放连接,所以用了一阵后,就出现NullPointException.而重新启动服务器,就把以前的连接自动断掉,所以又可以用一阵了.
呵呵,上面上猜的,我还没用过数据池.
原因可能是:你建立的数据池连接用完了,而你用完了连接没有去释放连接,所以用了一阵后,就出现NullPointException.而重新启动服务器,就把以前的连接自动断掉,所以又可以用一阵了.
呵呵,上面上猜的,我还没用过数据池.
|
呵呵,这个问题很头疼,我也遇到过,应该不是程序的问题,是服务的问题。。。
|
Root cause:
java.lang.NullPointerException
at com.mysql.jdbc.Statement.executeQuery(Unknown Source)
at com.mysql.jdbc.jdbc2.Statement.executeQuery(Unknown Source)
at com.codestudio.sql.PoolManStatement.executeQuery(PoolManStatement.java:105)
空指针错误,你相同的bean是连接数据库的吗?
把你的bean拿出来看一看.
java.lang.NullPointerException
at com.mysql.jdbc.Statement.executeQuery(Unknown Source)
at com.mysql.jdbc.jdbc2.Statement.executeQuery(Unknown Source)
at com.codestudio.sql.PoolManStatement.executeQuery(PoolManStatement.java:105)
空指针错误,你相同的bean是连接数据库的吗?
把你的bean拿出来看一看.
|
看你的错误好象是数据库连接错误,没有正常连接connection对象句柄为空
|
应该是没有与数据库正常联接 这种错误以前也出现过 后来怎么解决的都忘了
|
我也关注这个问题
|
关注