解决tomcat6部署spring4+mybatisJSP页面产生的500错误,控制台报java.lang.NullPointerException的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决tomcat6部署spring4+mybatisJSP页面产生的500错误,控制台报java.lang.NullPointerException的问题相关的知识,希望对你有一定的参考价值。

搭建spring4+mybatis+springMVC访问项目时产生异常:

严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.index_jsp._jspInit(index_jsp.java:22)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

一般抛这个异常的情况,在启动时不报异常,而在访问项目时报该异常。原因在于项目本身包含servlet.api.jar,而tomcat也包含该jar,二者产生冲突。

最简单的解决办法就是把该项目部署到tomcat7上就完美解决了该问题!

 

以上是关于解决tomcat6部署spring4+mybatisJSP页面产生的500错误,控制台报java.lang.NullPointerException的问题的主要内容,如果未能解决你的问题,请参考以下文章

MyBatis学习总结——Mybatis3.x与Spring4.x整合(转载)

MyBatis学习总结——Mybatis3.x与Spring4.x整合

MyBatis学习总结——Mybatis3.x与Spring4.x整合

MyBatis学习总结——Mybatis3.x与Spring4.x整合

[转]Mybatis3.x与Spring4.x整合

MyBatis学习总结_08_Mybatis3.x与Spring4.x整合