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

[Deployment] Changing of context root value doesn't affect on direct web module deployment #589

Open
lak-proddev opened this issue Aug 28, 2018 · 5 comments

Comments

@lak-proddev
Copy link
Contributor

STEPS
1.Create a web module web-test with default options .
2. Create index.jsp file with simple text Hello Wildfly
2.Change the context root to web-test-change
( Right click on project Properties > Web Project Settings )
3. Now deploy/publish the module to Wildfly server.
4.After successful deployment the module can be accessed with the context root http://localhost:8080/web-test

I think, it should be http://localhost:8080/web-test-change

Note: the context root value is working as expected for EAR modules

@lak-proddev
Copy link
Contributor Author

See WTP Bug.
Bug 133746 - Change context root of a web app doesn't work on server
https://bugs.eclipse.org/bugs/show_bug.cgi?id=133746#c9

See the context-root value will be the deployment(archive) name when deploying in auto deployment mode for many servers.

@robstryker
Copy link
Member

I left a comment at https://bugs.eclipse.org/bugs/show_bug.cgi?id=133746#c10

It is possible I can come up with a solution for JBT / jboss / wildfly / eap, but I'm not certain that I can. I will investigate it.

@robstryker
Copy link
Member

The file .settings/org.eclipse.wst.common.component has two areas with conflicting details. Here is an example of the contents of that file:

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="MyWeb8934">
        <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
        <property name="java-output-path" value="/MyWeb8934/build/classes"/>
        <property name="context-root" value="TestRob"/>
    </wb-module>
</project-modules>

You'll note that there's a deploy-name and a context-root. If the deploy-name is left blank, I can probably use the context-root to decide how to name the output war. However, if the deploy-name is NOT blank, and it conflicts with the context-root, then the only solution is to publish as MyWeb8934.war but add a jboss-web.xml with contextRoot = TestRob. But we don't like doing that... adding random files in the project. It's bad practice, especially on-the-fly during a publish.

I don't see any UI that exposes the deploy-name part of the module and allows users to change it. It's possible an enhancement to that preference page to allow setting the deploy-name in addition to the context-root might be useful for people.

@lak-proddev
Copy link
Contributor Author

Yes, You are right.

What i am thinking is, by default the deploy-name value should be the context-root value. User can customize these names using the property page UI. If he really needs it.

AFAIK for many server in auto deploy mode, the deployed file name (exploded or packaged) will be the context root.Unless there is a server specific deployment descriptor (*-web.xml ) file.

Only MyEclipse has the UI to customize the deploy-name property.

One important use case is,
If you deploy any maven web application using Jboss tools, the application is accessible at http://localhost:8080/<project-name>-<version>-SNAPSHOT

I think, it should be http://localhost:8080/<project-name> Or <context-root>

Actually, this issue was filed for above usecase.

@robstryker
Copy link
Member

What i am thinking is, by default the deploy-name value should be the context-root value.

It should be, but, unfortunately, these are two different data fields in the file. In my opinion the best way to fix this is to update the preference page to display both context-root and deploy-name. Some server adapters may ignore the context-root option (rather than modify or add a jboss-web.xml on the fly) so giving the user the option to change the deploy-name is pretty important I feel.

I'll work on an upstream patch for this.

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

2 participants