JSP Compiler Negative Time

What could be causing this error? Javadoc for File.java says that it will throw this exception if it gets passed a negative value. So, the question is why jasper passes a negative meaning. I searched for the sources of jasper, but I did not find those that match exactly with what I use, the line numbers do not exactly match. The version on which I am setting the last modified time from File.lastModified, which should never return a negative value, according to 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 sources for Tomcat and read the sources. Relevant code from Compile.java:

 375 File javaFile = new File(ctxt.getServletJavaFileName()); 376 Long jspLastModified = ctxt.getLastModified(ctxt.getJspFile()); 377 javaFile.setLastModified(jspLastModified.longValue()); 

ctxt is a JspCompilationContext that by default returns -1 by default if there are any errors, and File throws an IllegalArgumentException from the negative argument. I still don't know why I get the error message, at least I know where the IllegalArgumentException comes from.

+7
source share
4 answers

I had the same problem with 7.0.27 when I deployed applications from IntelliJ Idea with a trailing slash in the application context - deleting this worked for me

+5
source

I was getting this error when my WAR file had spaces and periods in its name. Removing them fixed the problem.

+4
source

There is an error if the file or the containing folder contains arithmetic characters. Since then, the error has been fixed since 7.0.27 .

I really run 7.0.32 and still ran into this problem, but since I noticed that it had problems with arithmetic characters, I would test the theory. Of course, the cause of my problem was that the folder containing the name contained a space character. I removed the space in the folder name and it works fine. I did not look in detail until I found out if there is a new error regarding space, but I will check it and send it if not.

+3
source

Looks like a bug in Tomcat. Try Tomcat 7.0.16, in it it does not explicitly specify the last change in the generated Java file. After this version, it has been modified. If it works with 7.0.16, I would report an error for the Tomcat guys with the most detailed platform information (Redhat 5 is not enough information).

0
source

All Articles