Bug 61601

Summary: Make Tomcat multi-release JAR aware
Product: Tomcat 9 Reporter: Mark Thomas <markt>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: -----   
Hardware: PC   
OS: Linux   
Attachments: Java 8 / 9 JAR for testing
Java 8 / 9 JAR for testing

Description Mark Thomas 2017-10-09 16:53:41 UTC
Created attachment 35406 [details]
Java 8 / 9 JAR for testing

The attached JAR file contains an annotated Servlet 4.0 ServletContextListener with both a Java 8 and Java 9 version. Each version simply outputs the Java version to stdout.

When deployed on Tomcat 9, the Java 8 listener is reported whether running on Java 8 or Java 9.
Comment 1 Mark Thomas 2017-10-12 08:35:34 UTC
Created attachment 35413 [details]
Java 8 / 9 JAR for testing

Updated JAR as the original was missing the necessary Manifest entries.

Fixing this is going to be 'interesting'. Tomcat currently enumerates the JAR entries as part of the scanning process. The enumeration provided by JarFile is not version aware. I need to do some more research on possible ways of filtering this enumeration efficiently.
Comment 2 Mark Thomas 2017-10-18 20:54:09 UTC
Fixed in:
- trunk for 9.0.2 onwards
- 8.5.x for 8.5.24 onwards
- 8.0.x for 8.0.48 onwards
- 7.0.x for 7.0.83 onwards