LKBEN11186: Howto deploy a glassfish webapp so it will be the default web application


This article has not been checked!

LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False

Author: Wim Peeters - Keskon GmbH & Co. KG


Symptom

You do not want the context-root to be include in the web URL

Cause

Glassfish adds the name of the web application to the URL by default so urls look like http://webservername:8080/webappname

Solution

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.

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!