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 0.0.0.0--listenerport 8888 --defaultvs myHost --servername localhost.localdomain --acceptorthreads 1 myHttpListener

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

http://localhost:8888/

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.
vs0.jpg

Enter the required info and press save

vs1.jpg

You should see your newly created virtual-server.

vs2.jpg

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

hl1.jpg

Enter the required info and press save

hl2.jpg

You should see your newly created http-listener:

hl3.jpg

Then with your browser, just add the new address:
test.jpg

C'est tout!!!

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

technorati: