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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…