Tomcat服务启动成功,但访问index.jsp出错 (jspInit)【转】

本文引用自 --> http://zhouhaitao.iteye.com/blog/1164736

Tomcat服务启动成功,但访问index.jsp出错

环境:Tomcat6 + jdk6

Tomcat服务启动成功,但访问index.jsp出错,Tomcat报错如下:

jspInit  NullPointerException

严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
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:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
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:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Thread.java:619)

原因:

jsp-api.jar冲突, 会造成jsp页面无法解析。

写自定义标签的时候请注意,在工程编译的时候可以引用jsp-api.jar,但发布的时候工程不要包含此包,因为Tomcat已包含。

jsp-api.jar用于开发,而不用于发布

解决方法1:User Library  或者 外部引用Add External JARS

选中项目-->右击-->properties-->Java Build Path --> Add Library --> 选中 User Liberary -->

Next --> User Libraries... --> New -->如下一定要选中:口 System Library.... (作为系统库像JDK一样)

Tomcat服务启动成功,但访问index.jsp出错 (jspInit)【转】

--> Add Jars -->导入 与Tomcat冲突jar --> 选中jsp-jar OK

解决方法2:修改配置

打开项目目录,编辑.classpath文件

将:<classpathentry kind="lib" path="/............/jsp-jar"/>

改:<classpathentry kind="con" path="/............/jsp-jar"/>

刷新项目OK

结果导入的jar包显示为系统库:

Tomcat服务启动成功,但访问index.jsp出错 (jspInit)【转】

上一篇:webservice MaxReceivedMessageSize :已超过传入消息(65536)的最大消息大小配额


下一篇:在Linux服务器上配置Transmission来离线下载BT种子