论坛首页 Java企业应用论坛

抓狂的问题

浏览 3944 次
锁定老帖子 主题:抓狂的问题
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2014-08-16  
2014-8-14 13:43:43 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [action] in context with path [] threw exception [java.lang.NullPointerException] with root cause
java.lang.NullPointerException
at org.quickupstart.struts.action.LoginValidateAction.execute(LoginValidateAction.java:33)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.quickupstart.common.EncodingFileter.doFilter(EncodingFileter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

应用在本地跑没有一点问题,部署到服务器,一触发功能后台就抛这个异常,但是前台也没有报HTTP 500错误,功能运行正常。

异常里说的33行报红指针,代码如下:
HttpSession session = request.getSession(false);
		
String validate_code = session.getAttribute("code").toString();//这个是33行


用log4j也可以输出值。已经晕了!抓狂中........................
   发表时间:2014-08-19  
HttpSession session = request.getSession(false);  
      
String validate_code = session.getAttribute("code");
validate_code = validate_code == null ? "" : validate_code.toString();
1 请登录后投票
   发表时间:2014-08-19  
HttpSession session = request.getSession(false);
不存在session时不新建,
if (session != null) {xxxx}
toString 如楼上
0 请登录后投票
   发表时间:2014-08-21  
session里没有code
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics