Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Tomcat context path of web project in Eclipse

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:

  • Updated the server.xml path value in the Context section

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.

Here are my Server settings within Eclipse.

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.

like image 747
acvcu Avatar asked Mar 01 '12 18:03

acvcu


People also ask

How do I change the context path of a web application in Eclipse?

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.

How do I change Tomcat deploy path in Eclipse?

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.

How do I change Tomcat settings in Eclipse?

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.


2 Answers

  1. In project properties click on Web Project Settings (assuming you are in a dynamic web project.) The only configuration value there is "Context root:"
  2. change "Context root" to /app
  3. rebuild
  4. remove the project from tomcat
  5. redeploy.
like image 138
digitaljoel Avatar answered Sep 22 '22 14:09

digitaljoel


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. enter image description here

Step 4: Click Ok button on the dialogue Box. enter image description here

Step 5: Click Yes on the next dialogue Box. enter image description here

Step 6: Rebuild your project.

like image 22
hKs Avatar answered Sep 21 '22 14:09

hKs