Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

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

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

Installing Apache Geronimo

Follow the normal process for installing Apache Geronimo. Instructions are located at Apache Geronimo Quickstart. Basically 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

...

Source

Destination

<jsw_home>/bin/wrapper.exe

<geronimo_home>/bin/wrapper.exe

<jsw_home>/lib/wrapper.jar

<geronimo_home>/lib/wrapper.jar

<jsw_home>/lib/wrapper.dll

<geronimo_home>/lib/wrapper.dll

In addition, Create the following files will also be created as part of this configuration processunder their specified directories according to the instructions in the #Configuring the Wrappe section. You can also download the files directly and placed them at the given locations.

Configuring the Wrapper

The Java Service Wrapper comes with has a sample configuration file wrapper.conf, which is pre-configured to run a test script also provided, this file . This file is located in the <jsw_home>\/conf directory. In this section we provide a Geronimo specific wrapper.conf file for your convenience.file for your convenience.

Create As we are trying to keep all the wrapper files within Geronimo's directory structure, create the configuration file as illustrated in the following example and place it in the <geronimo_home>/var/config/wrapper.conf directory. In this way we can keep all the wrapper files within Geronimo's directory structure.

No Format
borderStylesolid
titlewrapper.conf
# Location of java.exe (in Windows)

wrapper.java.command=<java_home>/bin/java

# These additional parameters are required to start the server since we are not setting any
# environment variables prior to running the wrapper.

wrapper.java.additional.1=-javaagent:"<geronimo_home>/bin/jpa.jar"
wrapper.java.additional.2=-Djava.ext.dirs="<geronimo_home>/lib/ext;<java_home>/jre/lib/ext"
wrapper.java.additional.3=-Djava.endorsed.dirs="<geronimo_home>/lib/endorsed;<java_home>/jre/lib/endorsed"
wrapper.java.additional.4=-Dorg.apache.geronimo.home.dir="<geronimo_home>"
wrapper.java.additional.5=-Djava.io.tmpdir="<geronimo_home>/var/temp"

# Classpath

wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../bin/server.jar


# Location of the wrapper.dll (in Windows)

wrapper.java.library.path.1=../lib

# Main class the wrapper will use.

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Geronimo start class and parameters.

wrapper.app.parameter.1=org.apache.geronimo.cli.daemon.DaemonCLI

# Log settings.

wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=../var/log/wrapper.log
wrapper.logfile.format=LPTM
wrapper.logfile.loglevel=INFO
wrapper.logfile.maxsize=0
wrapper.logfile.maxfiles=0
wrapper.syslog.loglevel=INFO

# Windows service name and description.

wrapper.console.title=Apache Geronimo v2.2 Server
wrapper.ntservice.name=Geronimo
wrapper.ntservice.displayname=Apache Geronimo v2.2 Server
wrapper.ntservice.description=Apache Geronimo v2.2 Server
wrapper.ntservice.dependency.1=
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false

where

  • replace <geronimo_home> and <java_home> with the appropriate settings for your environment.

This service wrapper allows three different methods of integration depending on, among other things, whether you use the same class or not to start and stop the server.

...

As we mentioned before, for this example we are trying to locate all the wrapper related files within the Geronimo directory structure. As you can see in the wrapper.conf shown above, most of the directory references are relative to Geronimo's installation directory. You will only have to replace <geronimo_home> and <java_home> with the appropriate settings for your environment.

Next we will create a batch file to run the service from the command line without the need of actually installing the service. This is particularly helpful when testing and debugging the configuration. Create the g_service.bat batch file in the <geronimo_home>/bin directory and copy the content of the following example.

...

This file is a modified version from the one provided by the wrapper as a sample, it has been edited to specify the location of the wrapper.conf file relative to Geronimo's var/config directory.

You can now run Geronimo as a service from a command line, simply run the following command:

...