I had a webapp named Test
, it was running some servlets on the path /Test
, by default, taking the appname
as the context path.
I made a copy of this project in Eclipse, and renamed it to TestNew
, now when i run this on tomcat (from within eclipse) it still runs on /Test
, though if i had created a new app, it would have run on /TestNew
I tried looking for the setting or the appname in web.xml
, pom.xml
etc, but i could not find the appropriate place to change this.
Any ideas?
Ok, I was able to resolve the issue.
When we make a copy and rename the project, it doesn't update in certain places, specifically, in .settings/org.eclipse.wst.common.component
file.
So, just open the file and replace the old appName
to new appName
everwhere it appears. In my case,
<wb-module deploy-name="appName">
<property name="java-output-path" value="/appName/target/classes"/>
<property name="context-root" value="appName"/>
</wb-module>
and Done! Now tomcat from inside eclipse gets the correct name.
(Not sure whether we would have faced the same issue in an external tomcat deployment, as the .settings/file seems only relevant to eclipse)