title: Cause of 'tmpFile.renameTo(classFile) failed' during JSP compilation
body: <p>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:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>After few retries (where few is 0 to ~ 7), the page gets eventually compiled and renders OK.</p>
  
  <p>Platform is Windows 7-Pro 64 bit, Java version is</p>
  
  <pre><code>c:\ATG\ATG2007.1&gt;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)
  </code></pre>
  
  <p>JBoss version: </p>
  
  <pre><code>16:49:51,384 INFO  [Server] Release ID: JBoss [Zion] 4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)
  </code></pre>
  
  <p>Tomcat version is 5.5 (the one included with JBoss).</p>
  
  <p>Thanks.</p>