Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect context root used to launch browser when EAR deployment assembly is modified #18

Open
rajivsen opened this issue Sep 28, 2017 · 1 comment

Comments

@rajivsen
Copy link
Contributor

The incorrect context root used to launch the browser when using Run on Server on a Servlet that is contained in a web module that is referenced in an EAR deployment assembly with the non default archive name.

Steps to reproduce:

Create a liberty server
Create a new web project that is added to an EAR
Open the EAR deployment assembly properties page and modify the Deploy Path for the web project so that it has a different name. Apply the change and close.
Create a servlet in the web project and do a Run on Server action on it.

Result:
Context root not found. Notice that in the server console log the web application is deployed and started and the context root matches the archive name in the deployment assembly. According to JEE spec this is the correct default context root.

From the JEE7 spec APPLICATION ASSEMBLY - 8.4.1 Assembling a Java EE Application section:
The context root is a relative name in the web namespace for the application. Each web module must be given a distinct and nonoverlapping name for its context root. The web modules will be assigned a complete name in the namespace of the web server at deployment time. If there is only one web module in the Java EE application, the context root may be the empty string. If no deployment descriptor is included in the application package, the context root of the web module will be the module name. See the Servlet specification for detailed requirements of context root naming.

@rajivsen rajivsen closed this as completed Oct 3, 2017
@rajivsen rajivsen reopened this Oct 4, 2017
eharris369 added a commit to eharris369/open-liberty-tools that referenced this issue Oct 4, 2017
… fail

The JEEContextRoot_EAR_NoDD_CRinWebXML is failing because of a commit
for issue OpenLiberty#18. The change will be reverted until the problem can be
further investigated.
@rajivsen
Copy link
Contributor Author

rajivsen commented Oct 4, 2017

The commit with PR #19 caused a test case failure in JEEContextRoot_EAR_NoDD_CRinWebXML. Erin found the root of the problem:

If that method returns null then it looks in the IBM extended web xml file. But now it is not returning null so it does not look there.

`if (contextRoot == null) { // Returns the context root from ibm-web-ext.xml file (XML, not XMI)
contextRoot = DeploymentDescriptorHelper.getContextRootFromExtXml(DeploymentDescriptorHelper.getComponentRoot(webModule.getProject())); }

if (contextRoot == null) { // Returns the context root from ibm-web-ext.xmi file (XMI, not XML) contextRoot = DeploymentDescriptorHelper.getContextRootFromExtXmi(DeploymentDescriptorHelper.getComponentRoot(webModule.getProject())); } `

The context root set in ibm-web-ext.xmi should take precedence. The logic added in PR #19 should probably be last in the order of precedence for context resolution.

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

No branches or pull requests

1 participant