{scrollbar}

top

This article will show you how to configure Apache Geronimo v1.1 to run as a MS Windows service. A Java Service Wrapper (JSW) will be required as an additional software to achieve this configuration. Using a JSW gives you some additional "control" on the service you are configuring such as the ability to ping the service and take action if the service is down.

In this article we will review the different configuration parameters of the JSW that controls the behavior of the service and the wrapper itself.

Software prerequisites

To set up Apache Geronimo v1.1 to run as a MS Windows service you will certainly need a Java Service Wrapper. For this example we used Java Service Wrapper 3.2.0 available for download at the following URL:

http://sourceforge.net/projects/wrapper/

For this example we are also using Apache Geronimo v1.1 running on Windows XP. You can download Apache Geronimo binaries from the following URL:

http://geronimo.apache.org/downloads.html

Installing Apache Geronimo

The installation of Geronimo from the binaries is very simple. Just extract the zip file to a directory of your convenience, throughout the rest of the article this directory will be referred to as <geronimo_home>.

Installing the Java Service Wrapper

Installing the wrapper is as simple as installing Apache Geronimo. Once you downloaded the right version for your environment you can extract the zip file to a directory of your convenience, throughout the rest of the article this directory will be referred to as <jsw_home>.

Configuring the wrapper

The Java Service Wrapper comes with a sample configuration file wrapper.conf pre-configured to run a test script also provided. In this section we provide a Geronimo specific wrapper.conf file for your convenience.

The wrapper configuration file is located in the <jsw_home>\conf directory. Backup the original file and create a new wrapper.conf file with the content from the following example.

solidGeronimo specific wrapper.conf #******************************************************************** # Wrapper Properties #******************************************************************** # Java Application wrapper.java.command=<java_home>\bin\java # Java Main class. This class must implement the WrapperListener interface # or guarantee that the WrapperManager class is initialized. Helper # classes are provided to do this for you. See the Integration section # of the documentation for details. wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperStartStopApp # Java Classpath (include wrapper.jar) Add class path elements as # needed starting from 1 wrapper.java.classpath.1=<jsw_home>\lib\wrapper.jar wrapper.java.classpath.2=<geronimo_home>\lib\cglib-nodep-2.1_3.jar wrapper.java.classpath.3=<geronimo_home>\lib\commons-cli-1.0.jar wrapper.java.classpath.4=<geronimo_home>\lib\commons-logging-1.0.4.jar wrapper.java.classpath.5=<geronimo_home>\lib\geronimo-common-1.1.jar wrapper.java.classpath.6=<geronimo_home>\lib\geronimo-deploy-jsr88-1.1.jar wrapper.java.classpath.7=<geronimo_home>\lib\geronimo-deploy-tool-1.1.jar wrapper.java.classpath.8=<geronimo_home>\lib\geronimo-deployment-1.1.jar wrapper.java.classpath.9=<geronimo_home>\lib\geronimo-j2ee-deployment_1.1_spec-1.0.1.jar wrapper.java.classpath.10=<geronimo_home>\lib\geronimo-kernel-1.1.jar wrapper.java.classpath.11=<geronimo_home>\lib\geronimo-qname_1.1_spec-1.0.1.jar wrapper.java.classpath.12=<geronimo_home>\lib\geronimo-system-1.1.jar wrapper.java.classpath.13=<geronimo_home>\lib\geronimo-util-1.1.jar wrapper.java.classpath.14=<geronimo_home>\lib\log4j-1.2.8.jar wrapper.java.classpath.15=<geronimo_home>\lib\mx4j-3.0.1.jar wrapper.java.classpath.16=<geronimo_home>\lib\mx4j-remote-3.0.1.jar wrapper.java.classpath.17=<geronimo_home>\bin\server.jar wrapper.java.classpath.18=<geronimo_home>\bin\shutdown.jar # Java Library Path (location of Wrapper.DLL or libwrapper.so ) wrapper.java.library.path.1=..\lib # Java Additional Parameters wrapper.java.additional.1=-Dorg.apache.geronimo.base.dir=<geronimo_home> wrapper.java.additional.2=-Djava.io.tmpdir=<geronimo_home>\var\temp wrapper.java.additional.3=-Djava.endorsed.dirs="<geronimo_home>\lib\endorsed" wrapper.java.additional.4=-Djava.extension.dirs="<geronimo_home>\lib\ext" # Initial Java Heap Size (in MB) #wrapper.java.initmemory=3 # Maximum Java Heap Size (in MB) #wrapper.java.maxmemory=64 # Application parameters. Add parameters as needed starting from 1 wrapper.app.parameter.1=org.apache.geronimo.system.main.Daemon wrapper.app.parameter.2=0 wrapper.app.parameter.3=org.apache.geronimo.deployment.cli.StopServer wrapper.app.parameter.4=false wrapper.app.parameter.5=4 wrapper.app.parameter.6=--user wrapper.app.parameter.7=system wrapper.app.parameter.8=--password wrapper.app.parameter.9=manager # Filter settings, if you want to have special behaviour for logged messages # uncomment the following lines #wrapper.filter.trigger.1=JSWRestartGeronimo #wrapper.filter.action.1=RESTART #wrapper.filter.trigger.2=java.lang.OutOfMemoryError #wrapper.filter.action.2=RESTART #******************************************************************** # Wrapper Logging Properties #******************************************************************** # Format of output for the console. (See docs for formats) wrapper.console.format=PM # Log Level for console output. (See docs for log levels) wrapper.console.loglevel=INFO # Log file to use for wrapper output logging. wrapper.logfile=<geronimo_home>\var\log\jsw.log # Format of output for the log file. (See docs for formats) wrapper.logfile.format=LPTM # Log Level for log file output. (See docs for log levels) wrapper.logfile.loglevel=INFO # Maximum size that the log file will be allowed to grow to before # the log is rolled. Size is specified in bytes. The default value # of 0, disables log rolling. May abbreviate with the 'k' (kb) or # 'm' (mb) suffix. For example: 10m = 10 megabytes. wrapper.logfile.maxsize=0 # Maximum number of rolled log files which will be allowed before old # files are deleted. The default value of 0 implies no limit. wrapper.logfile.maxfiles=0 # Log Level for sys\event log output. (See docs for log levels) wrapper.syslog.loglevel=NONE #******************************************************************** # Wrapper Windows Properties #******************************************************************** # Title to use when running as a console wrapper.console.title=Apache Geronimo v1.1 Server #******************************************************************** # Wrapper Windows NT\2000\XP Service Properties #******************************************************************** # WARNING - Do not modify any of these properties when an application # using this configuration file has been installed as a service. # Please uninstall the service before modifying this section. The # service can then be reinstalled. # Name of the service wrapper.ntservice.name=Geronimo # Display name of the service wrapper.ntservice.displayname=Apache Geronimo v1.1 Server # Description of the service wrapper.ntservice.description=Apache Geronimo v1.1 Server # Service dependencies. Add dependencies as needed starting from 1 wrapper.ntservice.dependency.1= # Mode in which the service is installed. AUTO_START or DEMAND_START wrapper.ntservice.starttype=AUTO_START # Allow the service to interact with the desktop. wrapper.ntservice.interactive=false

Do a search and replace all, look for the <java_home>, <geronimo_home> and <jsw_home> wildcards and replace them to match your environment.

Let's do a high level review what this configuration file does:

  • At the beginning of this configuration you set the path for the JAVA executable as well as the JAVA classpath to the Geronimo jars.
  • Then you specify the initial and maximum heap size for the JVM and pass along some startup related values such as user and password to start the service.
  • Next you provide the logging settings, this configuration file will create a log for the install, start, stop and uninstall of this Geronimo service in the <geronimo_home>\var\log directory.
  • Last but not least you give the service a name and set the start type.

Adding the service

Also provided with the wrapper are two scripts to install and uninstall the service. Since we are using the same wrapper configuration file name wrapper.conf there is no need to change any of the provided scripts.

To add Apache Geronimo as a MS Windows service run the following command:

<jsw_home>\bin\InstallTestWrapper-NT.bat

To remove the Apache Geronimo service run the following command:

<jsw_home>\bin\UninstallTestWrapper-NT.bat

Remember that for simplicity we are reusing the scripts already provided by the Java Service Wrapper installation, the script names are not relevant as both point to the wrapper configuration file we modified.

You can check the installation results in the <geronimo_home>\var\log\jsw.log file. You should see something similar to this:

solid STATUS | wrapper | 2006/03/24 15:39:18 | Apache Geronimo v1.1 Server installed.

Running the Apache Geronimo v1.1 service

To run the service you can use the MS Windows GUI interface or you can just use the command line option. For this working example the option of choice is the command line.

From a Windows command line run the command:

net start Geronimo

You should see a confirmation message similar to this:

#000000solid E:\JavaServiceWrapper\bin>net start Geronimo The Apache Geronimo v1.1 Server service is starting.. The Apache Geronimo v1.1 Server service was started successfully.

Note that Apache Geronimo may take a few moments to start even when you receive the message that the service has successfully started Geronimo may still be loading.

Check the <geronimo_home>\var\log\jsw.log to see if Geronimo is fully started, the last line in your log should be similar to this:

solid INFO | jvm 1 | 2006/06/28 13:06:39 | Geronimo Application Server started

Alternatively, if you have installed a tail command in Windows you could run the following command to monitor the status.

tail -f <geronimo_home>\var\log\jsw.log

Once you see in the log the Geronimo Application Server started message you are all set to go. You can open a Web broser and access the Geronimo Administration Console by pointing it to the following URL:

http://localhost:8080/console

  • No labels