1

当我通过输入地址从 Web 浏览器访问它时,我的 jsp 页面的 _jspInit 函数中出现 NullPointerException。我在网上搜索,他们中的大多数人说这是因为在我的 WEB-INF/lib 文件夹中,有一个 .jar 文件 jsp-api.jar 与 tomcat 容器的 jar 文件相冲突,如java.lang.NullPointerException 在org.apache.jsp.page_jsp._jspInit 在 Tomcat 6 中,但在 Tomcat 7中有效。但是,我检查了 lib 文件夹并没有找到这样的 jar 文件。是什么原因以及如何解决?

这是jsp错误页面:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.NullPointerException
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:538)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

java.lang.NullPointerException
    org.apache.jsp.index_jsp._jspInit(index_jsp.java:25)
    org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.

这是我在tomcat6中我的Web应用程序的lib目录中的jar文件列表:

activation-1.1.jar              
antlr-2.7.6.jar                 
bean-validator.jar              
c3p0-0.9.1.jar                  
cglib-2.2.jar                   
commons-codec-1.2.jar           
commons-codec-1.4.jar           
commons-collections-3.1.jar     
commons-httpclient-3.1.jar      
commons-lang-2.4.jar            
commons-logging.jar             
commons-logging-1.1.jar         
cxf-api-2.2.9.jar               
cxf-common-schemas-2.2.9.jar    
cxf-common-utilities-2.2.9.jar  
cxf-rt-bindings-soap-2.2.9.jar  
cxf-rt-bindings-xml-2.2.9.jar   
cxf-rt-core-2.2.9.jar           
cxf-rt-databinding-jaxb-2.2.9.jar        
cxf-rt-frontend-jaxws-2.2.9.jar          
cxf-rt-frontend-simple-2.2.9.jar         
cxf-rt-transports-http-2.2.9.jar         
cxf-rt-ws-addr-2.2.9.jar                 
cxf-tools-common-2.2.9.jar               
dom4j-1.6.1.jar                          
ehcache-1.2.3.jar                        
emayclient-v2.jar                        
epcis-captureclient-0.5.0.jar            
epcis-commons-0.5.0.jar                  
epcis-queryclient-0.5.0.jar              
geronimo-annotation_1.0_spec-1.1.1.jar   
geronimo-jaxws_2.1_spec-1.0.jar          
geronimo-stax-api_1.0_spec-1.0.1.jar     
geronimo-ws-metadata_2.0_spec-1.1.2.jar  
hibernate3.jar                           
httpclient-4.1.jar                       
httpcore-4.1.jar                 
httpmime-4.1.jar                 
javassist-3.9.0.GA.jar           
javax.annotation.jar             
javax.ejb.jar                    
javax.enterprise.deploy.jar      
javax.jms.jar                    
javax.management.j2ee.jar        
javax.persistence.jar            
javax.resource.jar               
javax.security.auth.message.jar  
javax.security.jacc.jar          
javax.servlet.jar                
javax.servlet.jsp.jar            
javax.servlet.jsp.jstl.jar       
javax.transaction.jar            
jaxb-api-osgi.jar                
jaxb-impl-2.2.jar                
jboss-cache-1.4.1.GA.jar                     
jbosscache-core-3.1.0.GA.jar                 
jdom-2.0.4.jar                               
jsf-api.jar                                  
jsf-impl.jar                                 
json-20090211.jar                            
jsr311-api.jar                               
jstl-impl.jar                                
jta-1.1.jar                                  
junit.jar                                    
log4j-1.2.14.jar                             
m4uapi.jar                                   
mail.jar                                     
mysql-connector-java-5.1.21-bin.jar          
org.hamcrest.core_1.1.0.v20090501071000.jar  
oscache-2.1.jar
proxool-0.8.3.jar
qrgen-1.1.jar
saaj-api-1.3.jar
saaj-impl-1.3.2.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.5.8.jar
stax-api-1.0-2.jar
swarmcache-1.0RC2.jar
textmagic-sms-api-1.0.jar
webservices-api-osgi.jar
weld-osgi-bundle.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.9.jar
xml-resolver-1.2.jar
XmlSchema-1.4.5.jar
zxing-core-1.7.jar
zxing-j2se-1.7.jar
4

1 回答 1

1

假设 JAR 是正确的方向 - 我会检查它是否出现在common.loader您的catalina.properties文件(位于conf)目录下的属性中。

于 2013-01-08T06:53:45.437 回答