Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cause of 'tmpFile.renameTo(classFile) failed' during JSP compilation

Recently, I started to experience strange behaviour in JBOss 4.0.5 JSP application. The JSP compilation fails on first (second, third,..) attempt with exception:

17:24:29,909 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.io.IOException: tmpFile.renameTo(classFile) failed
        at org.apache.jasper.compiler.SmapUtil$SDEInstaller.install(SmapUtil.java:245)
        at org.apache.jasper.compiler.SmapUtil.installSmap(SmapUtil.java:164)
        at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:429)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

After few retries (where few is 0 to ~ 7), the page gets eventually compiled and renders OK.

Platform is Windows 7-Pro 64 bit, Java version is

c:\ATG\ATG2007.1>java -version
java version "1.5.0_21"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_21-b01)
Java HotSpot(TM) Client VM (build 1.5.0_21-b01, mixed mode)

JBoss version:

16:49:51,384 INFO  [Server] Release ID: JBoss [Zion] 4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)

Tomcat version is 5.5 (the one included with JBoss).

Thanks.

like image 280
Miro A. Avatar asked Sep 10 '10 21:09

Miro A.


3 Answers

Fast forward four years to 2014. Tomcat 8, Java 8, Windows 8, same error. After half a day of frustration it turns out to be caused by my antivirus software, which in my case was McAfee. I went extreme and uninstalled the whole thing. But there was probably some setting I could have made to exclude the Tomcat directories from live scanning.

like image 133
John Fitzpatrick Avatar answered Nov 14 '22 08:11

John Fitzpatrick


The folder that is throwing IOException is actually read only, after change it to writeable, things are working fine.

like image 22
Feng Zhang Avatar answered Nov 14 '22 06:11

Feng Zhang


This is related to Tomcat 5.5 bug 38713. It seems to be fixed in Tomcat 5.5.25 onwards.

like image 29
BalusC Avatar answered Nov 14 '22 07:11

BalusC