What might be causing an error like this? Javadoc for File.java says it will throw this exception if passed in a negative value. So the question is, why is jasper passing in a negative value. I looked for the jasper sources, but I didn't find ones that match exactly what I am running, the line numbers don't quite match up. The version I have sets the last modified time from File.lastModified, which should never return a negative value, according to the javadoc.
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.IllegalArgumentException: Negative time
at java.io.File.setLastModified(File.java:1258)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:376)
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:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
...
UPDATE: I downloaded the sources for Tomcat and read through the sources. The relevant code from Compile.java is:
375 File javaFile = new File(ctxt.getServletJavaFileName());
376 Long jspLastModified = ctxt.getLastModified(ctxt.getJspFile());
377 javaFile.setLastModified(jspLastModified.longValue());
ctxt is a JspCompilationContext, which helpfully returns -1 by default if there are any errors, and File throws IllegalArgumentException from a negative argument. I still don't know why I'm getting an error, at least I know where the IllegalArgumentException is coming from.
I had the same problem with 7.0.27 when I was deploying applications from IntelliJ Idea with a trailing slash in application context - removing it worked for me
I was getting this error when my WAR file had spaces and periods in its name. Removing them fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With