Bug 61601 - Make Tomcat multi-release JAR aware
Summary: Make Tomcat multi-release JAR aware
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2017-10-09 16:53 UTC by Mark Thomas
Modified: 2017-10-18 20:54 UTC (History)
0 users

Java 8 / 9 JAR for testing (2.22 KB, application/x-java-archive)
2017-10-09 16:53 UTC, Mark Thomas
Java 8 / 9 JAR for testing (2.24 KB, application/x-java-archive)
2017-10-12 08:35 UTC, Mark Thomas

Note You need to log in before you can comment on or make changes to this bug.
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