tags:

views:

838

answers:

4

I have developed a dynamic web project in eclipse. Now I can access it through my browser using the following url:

http://localhost:8080/MyDynamicWebApp

Now I want to change the access url to

http://localhost:8080/app

I changed the context root from the project properties | Web Project Settings | Context Root

But it is not working. The web app still has the access url as earlier. I have re-deployed the application on tomcat, re-started the tomcat and have done everything that should be done but the access url is the same as earlier.

I found that there were no server.xml file attached with the WARfile. The how the tomcat is determining that the context root of my web app is /MyDynamicWebApp and is allowing me to access the application through that url

A: 

Try to rename your project.

Ha
A: 

After changing the context root in project properties you have to remove your web application from Tomcat (using Add and Remove... on the context menu of the server), redeploy, then re-add your application and redeploy. It worked for me.

If you are struck you have another choice: select the Tomcat server in the Servers view. Double clicking on that server (or selecting Open in the context menu) brings a multipage editor where there is a Modules page. Here you can change the root context of your module (called Path on this page).

Csaba_H
A: 

If you are running Tomcat from Eclipse, it doesn't use the configuration from your actual Tomcat installation. It uses the Tomcat configuration that it created and stored under "Servers" project. If you view your Eclipse workspace, you should see a project called "Servers". Expand that "Servers" project and you will come across server.xml. Open this file and scroll all the way to the bottom, and you should see something like this:-

<Context docBase="abc" path="/abc" reloadable="true" source="org.eclipse.jst.jee.server:abc"/>

Here, you can just change your project context path to something else.

Hope this helps.

limc
A: 

Hi guys, I'm using Eclipse Galileo and my problem is this one. I've created a Dynamic Web Project named Pippo. At step 3 of the creation wizard, I've defined the Context Path as Pluto. Now, I expect Eclipse to deploy my project with the context Pluto (as specified) but, on the contrary, it deploys with Pippo, and whatever I do I can't change this state. I've tried to follow your suggestions but nothing seems to work. Have you got any other idea?

Massimo