环境:
centos6.5 32位
oracle jdk 1.8
tomcat 7
问题:
yum install tomcat后,返回如下错误:
[root@centos]~# 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<Apache Tomcat/7.0.65 - Error report HTTP Status 500 - Unable to compile class for JSP:
type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
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
[root@centos]/usr/share/java# ll|grep ecj-rw-r--r-- 1 root root 1442090 11月 11 2010 ecj-3.4.2.jarlrwxrwxrwx 1 root root 13 9月 15 00:53 ecj.jar -> ecj-3.4.2.jarlrwxrwxrwx 1 root root 13 9月 15 00:53 eclipse-ecj-3.4.2.jar -> ecj-3.4.2.jarlrwxrwxrwx 1 root root 21 9月 15 00:53 eclipse-ecj.jar -> eclipse-ecj-3.4.2.jarlrwxrwxrwx 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
posted on 2016-09-15 11:33 阅读( ...) 评论( ...)