Platform Services Available in V3

Platform Services have just been rolled out for the first 2 platforms:

  • Solaris  Management Facility (SMF)
  • Windows

In the simplest case where you have one default domain and you want to run it as a service you run this command:

asadmin create-service

Here are all of the options:

[--passwordfile password-file] [--name service-name] [--serviceproperties (name=value)+] [--dry-run=false] [--domaindir domain_parent_directory] [domain_name]

 Once you have created the service it can be controlled in various ways by operating system and native tools. 


We use Windows Service Wrapper as the tool for installing the service.  It can be used to start stop and uninstall the service.  It can be found in the bin subdirectory of the domain directory.  In the default case the name of the executable will be domain1Service.exe  The directory also contains the configuration file, domain1Service.xml.  Below are the available commands:

  • domain1Service start
  • domain1Service stop
  • domain1Service uninstall
  • domain1Service install
You can also manage the GlassFish service with Windows tools:  Services snap-in and the net command line program.

Solaris  Management Facility (SMF)

You create the service exactly the same as WIndows.  One big difference for most users is that on Windows most users have administration privileges.  I.e. everyone is super-user.  Not so on Solaris.  In order to create a service you must have SMF privileges.  How to set that up is beyond the scope of this blog, but root definitely has these privileges by default 

 Important: If root creates a service then only root can start that domain from then on.  The best way to set this up is to install and/or create the domain as root and then create the service as root.

Once you have created the service you need to start it yourself.  Here are the most typical Solaris commands of interest:

  • /usr/bin/svcs  -a | grep domain1  // status
  • /usr/sbin/svcadm enable domain1 // start
  • /usr/sbin/svcadm disable domain1 // stop
  • /usr/sbin/svccfg delete domain1 // uninstall

Future Directions

If there is interest, demand and time we will add support for controlling the service from CLI:

  • start
  • stop
  • uninstall
  • restart


Kudos! This goes a long way, although sadly, it does not get the attention it deserves.

Posted by Kedar Mhaswade on June 01, 2009 at 07:27 AM PDT #

One comment I'd have is make the binding to privileged ports (80, 443) more obvious. Currently, I think it is rather weird. For example, since you already have access to domain.xml, why not parse it and if the user is using port < 1024, automatically assign a net_privaddr?

Posted by Kedar Mhaswade on June 01, 2009 at 07:29 AM PDT #

Would it not make more sense to be able to setup a "service" for a node agent, a cluster or for a standalone instance?

Posted by Jesper Söderlund on June 06, 2009 at 06:57 AM PDT #

Cool features.......
These two are very important features.


Posted by Homer Yau on June 06, 2009 at 06:01 PM PDT #

V3 has no node agents or instance servers. They are coming back in 3.1

In the meantime you can definitely use the Windows Service Wrapper to start different kinds of V2 servers. Take a look at the config file and tweak a V2 version.

Posted by W Byron Nevins Jr on June 06, 2009 at 06:14 PM PDT #

What, no node agents or instances? I must do some more reading on V3, I just assumed that it would be able to be a replacement for V2, just better.
Now it seems that it's better in a lot of areas while still leaving some things wanting. I'll be back :)

Posted by Jesper Söderlund on June 06, 2009 at 11:20 PM PDT #

After V3 is out I also guess that Oracle's influence will start to show in the product planning, so we'll see what that brings.

My personal thoughts is that they cannot motivate major investment into a product line which (previously at least) was on a direct trajectory to compete head-to-head with Weblogic, but we'll see.

Posted by Jesper Söderlund on June 06, 2009 at 11:24 PM PDT #

Although it is a common mistake users make on installation, most users don't have admin privileges on windows. Not so for vista. Not so for corporate users, most of the time. Nobody should work with administrative privileges unless for specific tasks, ms has recommanded this for ages.

Posted by Yannick Majoros on June 07, 2009 at 06:41 PM PDT #


I don't know how MS does it, but if it is my desktop, I should be able to start/stop services at will and I should be able to start/them when the desktop boots up/shuts down.

On Solaris, this is granted to you by the super-user via a privilege called "solaris.smf.\*". I don't need to be "root". Thus, if I have this specific privilege on a given machine, I will be able to put my services under service management control. What's the Windows equivalent of it?

Posted by Kedar Mhaswade on June 10, 2009 at 05:52 AM PDT #

I've not found this functionality in Glassfish v3 preview. Should it be available? Am I missing something? I'm running windows server 2003.

Posted by David Birch on July 14, 2009 at 03:47 AM PDT #


it should be available on nightly builds post Preview. Sorry, we don't have it for Preview builds (I guess). Check for latest nightly builds for v3 (b54, for ex.).


Posted by Kedar Mhaswade on July 14, 2009 at 04:22 AM PDT #

Very interesting! And adding those features to the CLI would be very helpful for GF users.

Posted by adamo901 on February 24, 2010 at 08:07 PM PST #

I am running on Windows 2003 Server and was attempting to use the asadmin command to create a service when I came across the following error:

Error while trying to install GlassFish as a Windows Service.
The return value was: -2146232576.

It appears this is cause by NOT having the .net framework installed. I installed 3.5 sp1 and was able to create the service.

Posted by Ryan Terry on April 06, 2010 at 05:48 AM PDT #

This doesn't work on Windows 2003:

Hopefully this is pilot error.

Posted by Laird Nelson on September 11, 2010 at 04:22 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed



« June 2016