2012年5月9日

解决Tomcat 之org.apache.jasper.JasperException: Unable to compile class for JSP问题

解决Tomcat 之org.apache.jasper.JasperException: Unable to compile class for JSP问题


当你在Tomcat布建专案时,常会发生一个错误,就是会将你的专案整个复制到Tomcat 的webapps目录中忘了WEB-INF目录可能会存在于专案的目录中,就会发生类似下列错误


HTTP Status 500 -

--------------------------------------------------------------------------------



type Exception report

message

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:597)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2672)
org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:1088)
org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1310)
org.apache.jasper.servlet.JasperLoader.getResourceAsStream(JasperLoader.java:144)
org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:193)
org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPackage(LookupEnvironment.java:639)
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:86)
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:147)
org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:590)
org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:357)
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:371)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:429)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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.26 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.26

解决的方式为将专案目录中的WEB-INF目录删除即可解决这种无法建立class的jar冲突

没有评论:

发表评论

BlogAD