A new feature has been added to NetPhantom to allow any NetPhantom server process to be executed as
a Service under Windows NT/2000/2003/XP.
As Microsoft is about to remove (and has already done for several products, such as new versions of
Windows XP and Windows Server 2003) its Java VM from its products, it is important to be able to
run the NetPhantom Server, Cluster Controller and License Manager using another Java VM, e.g. Sun
JDK 1.4.1 or better.
The new feature enables the NetPhantom Server, Cluster Controller, License Manager or Generic Service
to be executed as a "Windows NT Service". This allows the NetPhantom process to run
using the latest and best performing Java VM available (currently Sun JDK 1.4.1_03 using
Hotspot Server Just-In-Time option -server included with the Sun JDK). The services created are
started with the current directory set to the NetPhantom Server installation root directory (and drive).
The service can be installed several times; the only requirement is that the service name be
different. The tools used to do this are included in the Microsoft Resource Kit for Windows 2000 and are
shipped with NetPhantom for convenience purposes. These tools are compatible with Windows NT/2000/2003/XP.
Under the server root directory, the subdirectory ntservice contains the required files.
A batch file (is.bat) is used to install or uninstall the service(s), and 3 utilities that belong
to the Windows 2000 Resource Kit (Sc.exe, Srvany.exe and Regini.exe).
A new command line option -ntservice (specified after the start class) enables the following server
processes to run as a service:
- NetPhantom Server,
- NetPhantom Cluster Controller,
- NetPhantom Service,
- NetPhantom License Manager.
This option disables the Logoff signal for the server process that otherwise causes the process to be
closed when the console user logs off Windows.
Installing a Windows Service
To install a service, follow the steps below.
- Start a command prompt and set the current directory to the server installation root.
- Enter the following command:
ntservice\is INSTALL serviceName serverDir program javaDir memory [SERVERVM]
where:
| serviceName |
is the name of the service to use WITHOUT spaces or quotes. |
| serverDir |
the directory of the NetPhantom installation. |
| program |
can be
LICENSEMANAGER,
CLUSTERCONTROLLER,
SERVER or
SERVICE. |
| javaDir |
is the base directory for the installation of the Sun JDK WITHOUT spaces or quotes. |
| memory |
is the memory size in MB to use for the Java process. |
| SERVERVM |
indicates if the HotSpot Server VM should be used (included
with the JDK or better and NOT the JRE). This parameter is optional. |
This will create a Windows Service that is manually started at Windows boot when the network
has been started (service dependencies to Remote Procedure Call (RPC) and TCP/IP Protocol Driver
are added for the service in order to make them work properly when e.g. a server is rebooted).
The service Startup type can be changed from Manual
to Automatic by using Services from Administrative Tools in the Control Panel.
Example:
The command
ntservice\is INSTALL NetPhantomServer "C:\Program Files\NetPhantom" SERVER C:\j2sdk1.4.1_03 750 SERVERVM
will create a service that is run with the command
c:\j2sdk1.4.1_03\jre\bin\java.exe -server -Xincgc -Xrs -Xms750m
-Xmx750m se.entra.phantom.server.Start -ntservice -nteventlog
Note the option -Xincgc that sets incremental garbage collection option removing periodical halts in
program execution due to heavy garbage collection, and the option -Xrs that reduces signals from the operating
system (required when running as a Windows Service).
Note: Do not use spaces in the serviceName or javaDir and do not enclose them within quotes.
Uninstallation of a Windows Service
To uninstall a service, follow the steps below.
- Start a command prompt and set the current directory to the server installation root.
- Enter the following command:
ntservice\is UNINSTALL serviceName serverDir
where:
| serviceName |
is the name of the service to use WITHOUT spaces or quotes. |
| serverDir |
the directory of the NetPhantom installation. |
This will remove a previously created Windows Service of the name ServiceName.
Note: Do not use spaces in the serviceName and do not enclose it within quotes.
Registry Keys for a Windows Service
The example below shows the NetPhantomServer NetPhantom Windows Service as an example. This
serviceName can be replaced with any valid serviceName specified using the
ntservice\is command.
The keys and values below are set when creating the Service NetPhantomServer using the command
ntservice\is INSTALL NetPhantomServer "C:\Program Files\NetPhantom" SERVER "C:\j2sdk1.4.1_03" 750 SERVERVM
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ NetPhantomServer:
| DependOnService |
REG_MULTI_SZ |
RpcSs TcpIp |
|
| REG_DWORD |
0x00000001 |
| ImagePath |
REG_EXPAND_SZ |
C:\Program Files\NetPhantom\ntservice\srvany.exe |
|
| REG_SZ |
LocalSystem |
| Start |
REG_DWORD |
0x00000003 |
| Type |
REG_DWORD |
0x00000010 |
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ NetPhantomServer\Parameters:
| AppDirectory |
REG_SZ |
C:\Program Files\NetPhantom |
| Application |
REG_SZ |
C:\j2sdk1.4.1_03\jre\bin\java.exe |
| AppParameters |
REG_SZ |
-server -Xincgc -Xrs -Xms750m -Xmx750m -classpath .;..;samples;NetPhantomServer.jar; NetRexxR.zip;NetRexxC.zip;jssl.jar;jcrypto.jar;openxml-1.2-np.jar;mail.jar;activation.jar;rmi.zip;sms.jar se.entra.phantom.server.Start -ntservice -nteventlog |
| WaitTime |
REG_SZ |
By default this parameter is not present and should be set to the amount of seconds
to wait before the service is started. Valid range is 0 to 240 seconds (empty string or not defined equals to zero). |
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Eventlog\Application\NetPhantom Server:
This key is set when the server starts execution with the service name NetPhantom Server.
| EventMessageFile |
REG_EXPAND_SZ |
C:\Program Files\NetPhantom\WindowsNTEventLog.dll |
| TypesSupported |
REG_DWORD |
0x00000007 |
Waiting to start a Windows Service
When a complex IP network topology with NetPhantom License Manager(s) and NetPhantom Servers
being load balanced over several physical servers, in conjunction with Microsoft Network Load Balancing included in
Windows 2000 Advanced Server) is used, there are times when a service must be delayed a couple of seconds before
it is started when the physical Windows server is booting up.
The SRVANY program provided with NetPhantom supports this in the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
ServiceName\Parameters\WaitTime.
This parameter is defined as a REG_SZ entry with the possible values ranging from 0 to 240 seconds (inclusive,
empty string equals to zero). A default installation of the service does not create this entry (but the other three
AppDirectory, Application and AppParameters are present).
This new feature was introduced with NetPhantom 3.61 Build 1554.