-1

Is it possible to have my war deployed to localhost:8080 rather than localhost:8080/mywar

I put the way in autodeploy folder and if I add slash and war name the app loads just fine. Otherwise, localhost:8080 shows some welcome page.

I failed to find info on how to skip it and have my war file deployed to the root.

bianchi
  • 500
  • 2
  • 12

1 Answers1

1

Yes this is possible. You can set the context root for your web application in the file glassfish-web.xml. If you don't have this file, create it in the WEB-INF folder.

It should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application 
Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <context-root>/</context-root>
</glassfish-web-app>

This should work for Glassfish 3 and 4. For Glassfish 2 you need a similar file named sun-web.xml.

See also:

Community
  • 1
  • 1
unwichtich
  • 13,712
  • 4
  • 53
  • 66