Set context-root of Application running on Glassfish as the Domain Base

Introduction

Whether you want to set your ear, war or whatever type of application up on Glassfish, we typically want to get rid of the default landing page and replace it with one of the apps. This guide will show you how, with one image. This method is the easiest but has a caveat which I will mention later. It should work in Glassfish 3 and beyond, at the least.

Build

  • Glassfish 4.1
  • Using an Enterprise Application Archive (EAR)

Assumptions

  • Name of configuration and virtual server are default

Instructions

  1. Deploy your application
  2. Navigate to Configurations > server-config > Virtual Servers > server
  3. Select desired application on Default Web Module
  4. Save

Instruction Image

Caveat
If you specified in the configurations of your file a different context root (file depends on what type of application) then you will be able to access the application from the Domain Base as well as the context root defined in the application’s configuration file.