1. 程式人生 > >jdk8和tomcat7出現jsp無法編譯問題:Unable to compile class for JSP

jdk8和tomcat7出現jsp無法編譯問題:Unable to compile class for JSP

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 1 in the generated java file
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

An error occurred at line: 1 in the generated java file
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
	org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
	org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
	org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389)
	net.jeeshop.core.filter.XssFilter.doFilter(XssFilter.java:28)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)

這個錯誤有幾種可能性,如果你檢查servlet相關jar包無衝突問題,可以嘗試如下方法

同樣是tomcat7,老一點的版本出現問題,但是新一點的版本卻沒有這個問題,只需替換tomcat種的一個jar即可。

解決方式:下載最新tomcat7,把lib目錄下的ecj架包(應該是4.4.X版本)替換老tomcat7 lib目錄下的3.x版本即可