Tuesday, September 23, 2014

IOException : tmpFile renameTo classFile failed in JSP.

While coding with JSP I get random meaning less exceptions quite a time. Today when I run the Jsp suddenly ran in to the below exception.

HTTP ERROR: 500  
 tmpFile.renameTo(classFile) failed  
 RequestURI=/Index.jsp  
 Caused by:  
 java.io.IOException: tmpFile.renameTo(classFile) failed  
  at org.apache.jasper.compiler.SmapUtil$SDEInstaller.install(SmapUtil.java:241)  
  at org.apache.jasper.compiler.SmapUtil.installSmap(SmapUtil.java:163)  
  at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:429)  
  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)  
  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)  
  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)  
  at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)  
  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)  
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)  
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)  
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  
  at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)  
  at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)  
  at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)  
  at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)  
  at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)  
  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)  
  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)  
  at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)  
  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)  
  at org.mortbay.jetty.Server.handle(Server.java:324)  
  at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)  
  at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)  
  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)  
  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)  
  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)  
  at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)  
  at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)  
 Powered by Jetty://  

Cause of problem:


This happens when you have temporary class file generated for JSP and when you are restarting or reloading the Jsp, the same class file will be overridden with new content (name as well may be). When ever there is a problem in between doing this, this exception throws on our face :).


Resolution :


After so many restarts of my app and even PC too, I found the below solution.

  • Stop your application.
  • Clear you temp folder in the System.
  • Clean the project.
  • Restart the application.

Hope that solves your problem. Cheers.
Post a Comment