I'm using Tomcat 6 and using the Servers functionality in Eclipse to manage it. I have a project named foobar and I'd like to change the context path so that the URLs referenced are http://localhost:8080/app instead of http://localhost:8080/foobar. I've tried everything that I can think of:
From
<Context docBase="foobar" path="/foobar" reloadable="true" source="org.eclipse.jst.j2ee.server:foobar"/></Host>
To
<Context docBase="foobar" path="/app" reloadable="true" source="org.eclipse.jst.j2ee.server:foobar"/></Host>
I updated the file conf/Catalina/localhost/foobar.xml to set the path="/app" and docBase="foobar" with no luck.
I tried to remove the Module in Eclipse and redeploy at least a dozen times.
I went through the suggestions here: How to change context root of a dynamic web project in Eclipse?
I know that I can simply rename the project, but I don't want to.
EDIT:
I also should mention that I have some db settings in the application context. I am unsure if this should be set to foobar.xml or app.xml..? Eclipse automatically creates an app.xml file in conf/Catalina/localhost, but it seems to be ignored after I make changes.
Changing the context root of an existing web project in Eclipse. To change the context root of a web application that is already available in the Eclipse workspace, simply right-click on the web project and call the “Properties” action from the context menu.
In the opening window, you should see your tomcat installation. double click on that an a new setting page will open. You will see the Server Locations title, you can set it from that place.
For configuring the tomcat server in eclipse IDE, click on servers tab at the bottom side of the IDE -> right click on blank area -> New -> Servers -> choose tomcat then its version -> next -> click on Browse button -> select the apache tomcat root folder previous to bin -> next -> addAll -> Finish.
Web Project Settings
(assuming you are in a dynamic web project.) The only configuration value there is "Context root:"Step 1: In the project properties, click on Web Project Settings. The only configuration value there is "Context root:"
Step 2: change "Context root" to /app.
Step 3: Clean the tomcat server.
Step 4: Click Ok button on the dialogue Box.
Step 5: Click Yes on the next dialogue Box.
Step 6: Rebuild your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With