Bug 1337940

Summary: Tomcat 7.0.65 does not compile JSPs with JDK 8 (even not simplest official Apache Tomcat Sample war file)
Product: [Fedora] Fedora EPEL Reporter: Andreas M. Oberheim <andreas.oberheim>
Component: tomcatAssignee: Coty Sutherland <csutherl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: el6CC: alee, arusso, ben.harper, coolsvap, csutherl, dac, extras-qa, ivan.afonichev, jethrorevill, metherid, richard.ryder, sia, sidney, slp.vld, stefan.hecker, steve.chan, szymon
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: fst_owner=dcafaro, fst_ping=1
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1154978 Environment:
Last Closed: 2017-03-21 12:11:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1336481    
Bug Blocks: 1357654    

Description Andreas M. Oberheim 2016-05-20 13:52:35 UTC
+++ This bug was initially created as a clone of Bug #1154978 +++

Description of problem:

Tomcat 7.0.65 does not compile JSPs (even not simplest official Apache Tomcat Sample war file)

Delivered Error Page:

====

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/tomcat7_2/work/Catalina/localhost/sample/org/apache/jsp/hello_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/tomcat7_2/work/Catalina/localhost/sample/org/apache/jsp/hello_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)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.65 logs.
Apache Tomcat/7.0.65

====

Version-Release number of selected component:

Affects RHEL 6.8 System (redhat-release-server-6Server-6.8.0.5.el6.x86_64)
openjdk version "1.8.0_91" OpenJDK Runtime Environment (build 1.8.0_91-b14) OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
Apache Tomcat/7.0.65  ( tomcat-el-2.2-api-7.0.65-1.el6.noarch ) 


How reproducible: Always


Actual results: 
delivers HTTP Status 500 ... org.apache.jasper.JasperException: Unable to compile class for JSP ...

Expected results:
compiles JSP and deliver generated HTML page

Additional info:
When replacing the ...ecj...jar with the newest ECJ 4.5.1 compiling of JSPs is successful (but not on every RHEL 6.8 System)

There may be a workaround that seems to be very hakish:
Deinstalling and reinstalling JDK 7 & 8 and then deinstalling JDK 7
https://k4nz4k1g4w4.wordpress.com/2015/11/12/centosredhat-6-2-tomcat7-java1-8-the-type-java-util-mapentry-cannot-be-resolved/

Comment 1 Andreas M. Oberheim 2016-05-20 13:58:55 UTC
newest ECJ was downloaded from MVN:
http://mvnrepository.com/artifact/org.eclipse.jdt.core.compiler/ecj/4.5.1

Sample war that was used to reproduce bug:
https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/

Comment 2 Coty Sutherland 2016-05-20 14:09:02 UTC
Thanks for the report, but I'm already tracking this issue. Please see the original bug and it's ECJ blocker bug for more information. 

Additionally note that if you you're running the latest Java8 release you could try downgrading to the previous update to work around this; the latest updated changed the java.io.ObjectInputStream class and made it incompatible with RHEL6's current ECJ version.

*** This bug has been marked as a duplicate of bug 1223609 ***

Comment 3 Coty Sutherland 2016-05-20 14:37:08 UTC
Actually, the bug was just filed against the wrong product. I'm cleaning it up and moving it to Fedora EPEL since it's EPEL tomcat (tomcat 7, not RHEL6/tomcat6). The problem is still the same though; ECJ needs an upgrade to work with Java8 so I added the blocker for that.

Comment 4 Coty Sutherland 2017-03-21 12:11:45 UTC
The ECJ update (bug 1336481) has been released.