Skip to content

CONTAINER_JAR_PATTERN ignored on Windows #13588

@mvysny

Description

@mvysny

Jetty version(s)
Jetty 12.1.1

Jetty Environment
core

Java version/vendor (use: java -version)
openjdk-24.0.+12-54 x86-64

OS type/version
Windows 11

Description
The CONTAINER_JAR_PATTERN setting is ignored on Windows.

Upon further debugging, the problem is as follows:

  1. MetaInfConfiguration.findAndFilterContainerPaths() is called, which in turn calls ResourceFactory.split() to split up java.class.path.
  2. ResourceFactory.split() however always returns an empty list on Windows. The reason is that URIUtil.hasScheme() returns true for C:\foo\bar, causing the follow-up new URI() to throw an exception (since C:\foo\bar isn't a parsable URI).

How to reproduce?

final WebAppContext context = new WebAppContext();
final Resource webRoot = findWebRoot(context.getResourceFactory().newResource("C:\\"));
context.setBaseResource(webRoot);
context.setContextPath("/");
context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*\\.jar|.*/classes/.*");
context.setConfigurationDiscovered(true);
var server = new Server();
server.setHandler(context);
server.start();

On Linux, classpath is properly scanned, servlets are auto-discovered and activated. On Windows, no servlets are auto-discovered.

Metadata

Metadata

Assignees

Labels

BugFor general bugs on Jetty sideMicrosoft WindowsFor issues unique to Microsoft Windows

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions