新部署tomcat,An error occurred at line: [1] index_jsp.java

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了新部署tomcat,An error occurred at line: [1] index_jsp.java相关的知识,希望对你有一定的参考价值。

环境:

centos6.5 32位

oracle jdk 1.8

tomcat 7

问题:

yum install tomcat后,返回如下错误:

[[email protected]]~# curl -v http://localhost:8080

* About to connect() to localhost port 8080 (#0)

*   Trying 127.0.0.1... connected

* Connected to localhost (127.0.0.1) port 8080 (#0)

> GET / HTTP/1.1

> User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2

> Host: localhost:8080

> Accept: */*

> 

< HTTP/1.1 500 Internal Server Error

< Server: Apache-Coyote/1.1

< Content-Type: text/html;charset=utf-8

< Content-Language: en

< Content-Length: 2655

< Date: Thu, 15 Sep 2016 03:03:16 GMT

< Connection: close

< 

<html><head><title>Apache Tomcat/7.0.65 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Unable to compile class for JSP: </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Unable to compile class for JSP: </u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.apache.jasper.JasperException: Unable to compile class for JSP: 

 

An error occurred at line: [1] in the generated java file: [/usr/share/tomcat/work/Catalina/localhost/_/org/apache/jsp/index_jsp.java]

The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

 

An error occurred at line: [1] in the generated java file: [/usr/share/tomcat/work/Catalina/localhost/_/org/apache/jsp/index_jsp.java]

The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

 

Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:466)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

* Closing connection #0

#

 

 

网友介绍这是ecj.jar太老了。网友的版本事3.4.2,换4.2后ok。看下自己的ecj

[[email protected]]/usr/share/java# ll|grep ecj

-rw-r--r-- 1 root root  1442090 11月 11 2010 ecj-3.4.2.jar

lrwxrwxrwx 1 root root       13 9月  15 00:53 ecj.jar -> ecj-3.4.2.jar

lrwxrwxrwx 1 root root       13 9月  15 00:53 eclipse-ecj-3.4.2.jar -> ecj-3.4.2.jar

lrwxrwxrwx 1 root root       21 9月  15 00:53 eclipse-ecj.jar -> eclipse-ecj-3.4.2.jar

lrwxrwxrwx 1 root root       13 9月  15 00:53 jdtcore.jar -> ecj-3.4.2.jar

 

果然很老。

那么打开ecj看下, 果然很多编译相关的类啊!

技术分享

http://wiki.jikexueyuan.com/project/tomcat/classloading.html

 

用ecj-4.4.2.jar 替换老版本ecj后,重启tomcat,关闭防火墙,访问网页

技术分享

 

done

 

以上是关于新部署tomcat,An error occurred at line: [1] index_jsp.java的主要内容,如果未能解决你的问题,请参考以下文章

TOMCAT Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.

MyEclipse部署web项目到Tomcat出现An internal error occurred during: "Launching on Tomcat 7.x"的问题

Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors will be l

[Java Web]Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors(

TestNG运作报错An interanl error occurred during:"Launching first"

An error occurred while collecting items to be installed session context was:(profile=DefaultProfile