可能导致这样的错误的原因是什么? File. java的 Javadoc表示,如果以负值传递,它将抛出此异常.所以问题是,为什么碧玉传递负值.我寻找了jasper的来源,但是我找不到与我正在运行的完全相符
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)
…
更新:我下载了Tomcat的源代码并阅读了源代码. Compile.java的相关代码是:
375 File javaFile = new File(ctxt.getServletJavaFileName()); 376 Long jspLastModified = ctxt.getLastModified(ctxt.getJspFile()); 377 javaFile.setLastModified(jspLastModified.longValue());
ctxt是一个JspCompilationContext,如果有任何错误,它会默认返回-1,而File会从负参数中抛出IllegalArgumentException.我仍然不知道为什么我会收到错误,至少我知道IllegalArgumentException的来源.
当我使用IntelliJ Idea在应用程序上下文中使用尾部斜杠部署应用程序时,我遇到了与7.0.27相同的问题 – 删除它对我有用