java web应用程序出错[无法为JSP编译类]根本原因
Posted
技术标签:
【中文标题】java web应用程序出错[无法为JSP编译类]根本原因【英文标题】:Getting error on java web application [Unable to compile class for JSP] with root cause 【发布时间】:2016-03-28 15:33:24 【问题描述】:我已经使用带有 mysql 数据库的 hibernate 框架和以下配置开发了一个 Web 应用程序,并且出现以下错误。 这在重新启动 tomcat 服务器后工作。 仅此而已……
error.xhtml
index.xhtml
result.jsp
hibernate.cfg.xml
pdr
AccActivate.java
AccountBean.java
pdr.config
Config.java
pdr.entity
AccountDAO.java
CustomerAccountDAO.java
CustomerDAO.java
NfcAccountDAO.java
pdr.entity.sql
DuplicateEntry.java
SQLExceptionTypeDelegate.java
pdr.pojo
Account.java
Customer.java
CustomerAccount.hbm
CustomerAccount.java
NfcAccount.java
account.hbm
customer.hbm
nfc_account.hbm
pdr.util
ExceptionFiner.java
HibernateUtil.java
pdr.util.logger
Log.java
MyHtmlFormatter.java
MyHtmlFormatterExample.java
MyLogger.java
MyTestLogger.java
UseLogger.java
雄猫:
使用 CATALINA_BASE: /opt/apache-tomcat-7.0.65
使用 CATALINA_HOME: /opt/apache-tomcat-7.0.65
使用 CATALINA_TMPDIR: /opt/apache-tomcat-7.0.65/temp
使用 JRE_HOME: /usr/java/jdk1.8.0_65/
使用 CLASSPATH: /opt/apache-tomcat-7.0.65/bin/bootstrap.jar:/opt/apache-tomcat-7.0.65/bin/ tomcat-juli.jar
服务器版本: Apache Tomcat/7.0.65
服务器建成: 2015 年 10 月 9 日 08:36:58 UTC
服务器编号: 7.0.65.0
操作系统名称:Linux
操作系统版本: 2.6.32-573.7.1.el6.x86_64
架构: amd64
JVM 版本: 1.8.0_65-b17
JVM 供应商:甲骨文公司
MYSQL:
服务器版本 5.1.73 协议
版本 10 Connection Localhost via UNIX socket UNIX
socket /var/lib/mysql/mysql.sock
Java:
javac 版本 1.8.0_65
java 版本 1.8.0_65
- Java(TM) SE 运行时环境(内部版本 1.8.0_65-b17)
- Java HotSpot(TM) 64 位服务器 VM(内部版本 25.65-b01,混合模式)
操作系统
分销商 ID: RedHatEnterpriseServer
发布: 6.7
系统变量
回显 $JAVA_HOME
/usr/java/jdk1.8.0_65/
回显 $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/ usr/java/jdk1.8.0_65//bin:
Dec 22, 2015 5:41:34 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/] threw exception [Unable to compile class for JSP] with root cause
java.lang.IllegalArgumentException: Negative time
at java.io.File.setLastModified(File.java:1427)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:377)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Dec 22, 2015 5:41:34 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/] threw exception [java.lang.ClassNotFoundException: org.apache.jsp.index_jsp] with root cause
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:121)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:376)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
【问题讨论】:
File.java:1427(Line number) 里面有什么。它会给出 IllegalArgumentException 。 没有名为 File.java 的文件。我上面列出了里面的所有文件...请参考链接akaza.lk/promotions 【参考方案1】:你真正的问题是:java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
。
您已表明正在使用:
使用 JRE_HOME:/usr/java/jdk1.8.0_65/
Tomcat需要将jsp文件编译成servlet,所以需要JDK和JAVA_HOME。看来您使用的是 JDK,而是定义了 JRE_HOME。
确保您使用的是 JDK 而不仅仅是 JRE,并正确设置 JAVA_HOME。
【讨论】:
我已经添加了我的 $JAVA_HOME 和 $PATH 变量。请检查。我认为这不是问题。这是第一次,第二次和更多的工作正常。但突然发生错误。 好的。你检查this SO post了吗?好像和你的问题有关…… 谢谢你,@malaguna 我会检查的。以上是关于java web应用程序出错[无法为JSP编译类]根本原因的主要内容,如果未能解决你的问题,请参考以下文章
无法为 JSP 编译类:无法解析 java.util.Map$Entry 类型。它是从所需的 .class 文件中间接引用的
org.apache.jasper.JasperException:无法为 JSP 编译类: