You do not want the context-root to be include in the web URL
Glassfish adds the name of the web application to the URL by default so urls look like http://webservername:8080/webappname
You can deploy the application to the virtual server and set it to the default web module for this server in the Admin Console. To accomplish this you go to the configuration -> virtual servers -> server and select your application from the default web module dropdown box.
Now you can access your application by using the http://localhost:8080 URL directly.
Sometimes this might cause problems with applications using jdbcrealms. In this case you might try an alternative and deploy directly to "/".
This can be done with the command:
asadmin deploy --contextroot "/" warfile.war
In your management console you can see the difference between the two deployments. The latter has the parameter context-root set to "/" under applications and no default-web module under virtual servers.
About the Author
Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.