tomcat8.0一个坑爹的问题:Unable to compile class for JSP:

开发工具是Eclipse


数据库是MongoDB


jdk版本1.8


tomcat是8.0


将MySQL版的项目放在8.0上跑,ok,然后把底层换成MongoDB,所有的jar一换,再次运行发现,报了上述的错误~~~


然后是各种百度,最后终于找到原因了:

工程中的jar包【servlet-api.jar】跟tomcat中的【servlet-api.jar】冲突了


用tomcat自带的servlet-api.jar去替换项目中的jar,再次启动,问题得以解决!鼓掌~

org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [15] in the generated java file: [E:\four\apache-tomcat-7.0.64\work\Catalina\localhost\news\org\apache\jsp\util\newsControl_jsp.java] Only a type can be imported. javassist.bytecode.stackmap.BasicBlock.Catch resolves to a package Stacktrace: at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:485) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:379) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:619)
©️2020 CSDN 皮肤主题: 程序猿惹谁了 设计师:上身试试 返回首页