问题
Each time I run my web application on TomCat it gives me an error. There is nothing wrong with the .jsp files, just that I have to restart the server and sometimes the complete IDE for this error to go away.
The error is the following
Mar 12, 2014 5:57:01 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [jsp] in context with path [/Assignment_1_Flight_Reservation_System] threw exception [Unable to compile class for JSP] with root cause java.io.IOException: tmpFile.renameTo(classFile) failed at org.apache.jasper.compiler.SmapUtil$SDEInstaller.install(SmapUtil.java:204) at org.apache.jasper.compiler.SmapUtil.installSmap(SmapUtil.java:163) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:483) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744)
回答1:
Clean Tomcar work directory $TOMCAT/work to see if it solved it, and check permissions on work directory structure
回答2:
Clean Tomcat's working Directory along with Project.
Run and Restart the server and it should work
回答3:
I know this is late but in 2017, using Tomcat 8 this still happens.
The issue is either one of three things.
- You don't have proper permissions
If this is the case then this should be happening every time with every jsp. - Something funky is going on and you need to clear your work directory.
If this is the case then the issue is usually happening every time with every jsp but can be intermittent. - Another program, such as McAfee or Windows indexing, is reading the temporary class file and is disallowing it to be renamed.
This is what happened to my team. McAfee was scanning the newly created file and was causing the issue to be completely intermittent, it would just randomly occur. To fix this you can either go nuclear and uninstall your anti-virus, but if you are in an environment where this is not possible ask your Security Team to add a scanning exclusion on your work folder and on your Apache folder.
If this is not the issue try turning off Window's file indexing on your work folder and your Apache folder.
回答4:
For me it turned out to be TGitCache.exe from Tortoise Git. Must be trying to update the icon overlays.
回答5:
1) Clean tomcat work directory 2) Restart the workspace(if you are using server inside eclipse). 3) Restart the server.
This works for me.
来源:https://stackoverflow.com/questions/22364931/tomcat-jsp-page-not-compiling-java-io-ioexception-tmpfile-renametoclassfile