Search code examples
java-ee-6glassfish-3

Configure the path (localhost) of the war application to be the root (Java EE)


I want to change the path when I run my war-application locally... Right now, it is running on the default setting...

http://localhost:8080/myproject-war/ 

and I want it to be the root, something like:

http://myproject-war.local/

or

http://myproject:8080/

How can I do that???

Note: My app is a Java EE 6 Application with Glashfish using Netbeans 7.3


Solution

  • This post helped me out How do you deploy a WAR that's inside an EAR as the root (/) context in Glassfish?.

    • First, I added a Standard Deployment Descriptor (application.xml) to the Enterprise Application Project.
    • Then, change the path of the context root of your web application: <context-root>/myproject-war</context-root> to <context-root>/</context-root> or <context-root />
    • Finally, (optional) remove or rename the Glashfish index page (or redirect it to the welcome page). located in the Glashfish default folder such as C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\docroot

    Now the page web application will be visible on: http://localhost:8080/