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.
Windows
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
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 02:27 PM 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 02:29 PM 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 01:57 PM PDT #
Cool features.......
These two are very important features.
Thanks.
Posted by Homer Yau on June 07, 2009 at 01:01 AM 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 07, 2009 at 01:14 AM 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 07, 2009 at 06:20 AM 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 07, 2009 at 06:24 AM 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 08, 2009 at 01:41 AM PDT #
Yannick,
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 12:52 PM 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 10:47 AM PDT #
David,
it should be available on nightly builds post Preview. Sorry, we don't have it for Preview builds (I guess). Check https://glassfish.dev.java.net for latest nightly builds for v3 (b54, for ex.).
-Kedar
Posted by Kedar Mhaswade on July 14, 2009 at 11:22 AM PDT #