Jasper 2 compiler troubles

Since I’ve played with integrating a servlet engine (Jetty5) into my unit tests I ran into problems when it comes to jsp page compiling. The Jasper 2 Compiler from Apache (which Jetty5 uses) gives me the following stack trace, every 2nd or 3rd time the application is deployed within a unit test:

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:424)
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:303)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:286)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:171)
...

It seems this is a known bug and it’s tracked under #38713.

My solution for now is to precompile all my JSP pages for the embedded-server-test. See: Jasper 2 JSP Engine How To – Web Application Compilation

There are no comments on this post.

Leave a Reply