0

I wrote the web application using Spring MVC. When I deploy the app to the server path is localhost:8080/projectName/. It is possible to remove projectName from path from eclipse? I found path in project properties but I cannot find the way how to change it.

I found that I have to change context root to : "/". I changed it but that has no effect. Thank you for any help.
Regards,
Sebastian

  • 1
    Sebastian, i think the answer is already here: http://stackoverflow.com/questions/2437465/java-how-to-change-context-root-of-a-dynamic-web-project-in-eclipse – Leandro Carracedo Jan 26 '15 at 21:42
  • I tried it before. I am using wildfly 8.2 and it does not work. My app is always on localhost:8080/projectName/ – Sebastian Szwaczyk Jan 26 '15 at 22:44
  • Ok, try using jboss-web.xml like explained in the answer for the same question: http://stackoverflow.com/a/12201474/4316870 – Leandro Carracedo Jan 26 '15 at 22:57
  • Thank you Patrick, when I added jboss-web.xml I can deploy app to any path but when I deployed it to "/" and connect to localhost:8080 wildfly welcome page is displayed. I tried to turn off this using enable-welcome-root as it is described here: http://stackoverflow.com/questions/21957060/jboss-deploying-in-root-context but every time when I am restarting the server wildfly deletes new configuration. Also I found that is no more need for using enable-welcome-root and wildfly should automaticly turn off welcome page if something is deployed to /. – Sebastian Szwaczyk Jan 27 '15 at 15:30
  • For answer refer to this link http://stackoverflow.com/questions/2437465/java-how-to-change-context-root-of-a-dynamic-web-project-in-eclipse][1] – vicky Jan 29 '16 at 15:44
  • Refer to this link http://stackoverflow.com/questions/2437465/java-how-to-change-context-root-of-a-dynamic-web-project-in-eclipse – vicky Jan 29 '16 at 15:45

1 Answers1

0

I would break down your question into two parts :

A. Changes to the context root not taking any effect.

For changes to the context root to take effect, you must clean and republish you webapp on your server for the context root changes to get activated. To run "Clean" in context of the server from within eclipse,

  1. Stop the Server
  2. Window -> Show View -> Server -> Right click on your server configuration -> Clean. (Note: To "Clean" the server outside of eclipse, you need to go to the "webapps" directory of your server on your local filesystem and delete the .war file as well as the "project-name" folder which holds the exploded WAR file. )
  3. Deploy your webapp to the server and restart the server.

B. Trying to run your webapp at the context root / - localhost:8080

From what it looks like, you are trying to run your web application at the "Root" of your application server. You haven't mentioned the application server that you are using, but let us for example assume that the server you are using is tomcat. For tomcat, to deploy an application which will run at localhost:8080/ you need to either deploy the exploded war under the "ROOT" directory at $CATALINA_HOME/webapps/ROOT , or name your war file to be root.war.

The $CATALINA_HOME/webapps/ROOT and $CATALINA_HOME/webapps/root.war are special keywords which tell tomcat to deploy the application at content root /.

If you are NOT using tomcat as your application server, then provide more details on the application server being used to see if I can help.

MansiS
  • 1