Skip to main content

Dynamically Adding Virtual Servers in GlassFish

Posted by jfarcand on June 21, 2006 at 6:50 PM PDT

GlassFish (and SJSAS 9.0) supports a nice feature where you can add virtual-server (host) and http-listener on the fly, without having to reboot the server. You can do it using the admin GUI or the admin CLI. The admin CLI has a nice way to interact with GlassFish, so I will use it first.

Let's add a new virtual-server (make sure GlassFish is running):

% asadmin create-virtual-server -u admin --hosts localhost myHost

That's it. Now let's add a new http-listener so we can do some http transactions:

% asadmin create-http-listener -u admin --listeneraddress 8888 --defaultvs myHost --servername localhost.localdomain --acceptorthreads 1 myHttpListener

Now you can access the newly created virtual-server and http-listener by just doing:


For peoples that doesn't like kilometers of typing but like clicks, you can do the same using the admin gui

First, logs in and click on the left tree until you get.

Enter the required info and press save


You should see your newly created virtual-server.


Now, for the http-listener, browse the left tree until you get the http-listener screen and click add


Enter the required info and press save


You should see your newly created http-listener:


Then with your browser, just add the new address:

C'est tout!!!

Under the hood, the dynamic Grizzly is watching you....