Skip to content

fix: Derive the context path from the deployment archive name; resolve #285 - #287

Open
rhusar wants to merge 2 commits into
arquillian:mainfrom
rhusar:285-context-path
Open

fix: Derive the context path from the deployment archive name; resolve #285#287
rhusar wants to merge 2 commits into
arquillian:mainfrom
rhusar:285-context-path

Conversation

@rhusar

@rhusar rhusar commented Aug 5, 2026

Copy link
Copy Markdown
Member

Tomcat infers a web application's context path from its deployment name and
never from the path attribute of a WAR bundled META-INF/context.xml, which it
explicitly ignores. A "#" in the name denotes a path separator and a "##" the
start of a parallel deployment version.

The embedded container already delegated this to Catalina's ContextName, but
the managed and remote containers only stripped the file extension. Deploying
foo#bar.war through the manager therefore sent path=/foo#bar, which Tomcat
rejects outright:

FAIL - Failed to deploy application at context path [/foo#bar]

Add an equivalent ContextName for the modules that cannot depend on Catalina
and use it to send the decoded path, along with a version parameter for a
parallel deployment, to the manager. ProtocolMetadataParser now distinguishes
the two identifiers it had conflated: the JMX WebModule key needs the context
name, whereas a servlet's context root needs the context path, since a
versioned deployment is served from its path and not its versioned name.

Note that only the ".war" extension is stripped now, matching both Tomcat and
the embedded container, where the previous behaviour truncated at the last dot.

Also resolve the test servlet URL relative to the context root. A leading "/"
resolved against the host instead, so every non-root test was in fact invoking
the ROOT deployment's servlet.

rhusar added 2 commits August 5, 2026 10:42
…arquillian#285

Tomcat infers a web application's context path from its deployment name and
never from the path attribute of a WAR bundled META-INF/context.xml, which it
explicitly ignores. A "#" in the name denotes a path separator and a "##" the
start of a parallel deployment version.

The embedded container already delegated this to Catalina's ContextName, but
the managed and remote containers only stripped the file extension. Deploying
foo#bar.war through the manager therefore sent path=/foo#bar, which Tomcat
rejects outright:

  FAIL - Failed to deploy application at context path [/foo#bar]

Add an equivalent ContextName for the modules that cannot depend on Catalina
and use it to send the decoded path, along with a version parameter for a
parallel deployment, to the manager. ProtocolMetadataParser now distinguishes
the two identifiers it had conflated: the JMX WebModule key needs the context
name, whereas a servlet's context root needs the context path, since a
versioned deployment is served from its path and not its versioned name.

Note that only the ".war" extension is stripped now, matching both Tomcat and
the embedded container, where the previous behaviour truncated at the last dot.

Also resolve the test servlet URL relative to the context root. A leading "/"
resolved against the host instead, so every non-root test was in fact invoking
the ROOT deployment's servlet.

Signed-off-by: Radoslav Husar <rhusar@ibm.com>
Signed-off-by: Radoslav Husar <rhusar@ibm.com>
@rhusar
rhusar marked this pull request as ready for review August 10, 2026 21:35
@rhusar

rhusar commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@smagellan any chance you had time to test this change whether this resolves your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant