Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Anchortoptop

This article will show you how to configure Apache Geronimo server to run as a Microsoft Windows service. Currently, there are two options for running the server as a Windows service: using Apache Commons Daemon or using Java Service Wrapper.

Apache Commons Daemon

...

To set up Apache Geronimo server to run as a Microsoft Windows service using Apache Commons Daemon you will need to install the procrun plugin. Use the Administrative Console or deployer tool to install the plugin. Search for plugin named "Windows Service Wrapper".

Once the plugin is installed you can install Apache Geronimo server as a Windows service by running the following command:

<geronimo_home>\bin\service_pr.bat install

For example:

No Format
bgColor#000000
borderStylesolid

D:\geronimo-tomcat6-javaee5-2.2\bin>service_pr.bat install
The service "geronimosrv" has been installed.

 
This will create a Geronimo service for the server with the name "geronimosrv" with default parameters. You can start/stop the Geronimo service using Windows' Services tool or by running <geronimo_home>\bin\geronimosrvw.exe command.

...

Software Prerequisites

Microsoft .NET Framework Version 2.0+. For example, Version 2.0 is available for download at the following URL:
http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en

Installing Apache Commons Daemon

To set up Apache Geronimo server to run as a Microsoft Windows service using Apache Commons Daemon you will need to install the procrun plugin. Use the Administrative Console or deployer tool to install the plugin from the plugins repository. For example, on server 2.2, choose the http://geronimo.apache.org/plugins/geronimo-2.2/ repository and search for plugin named "Windows Service Wrapper".

Using Apache Commons Daemon

Once the plugin is installed you can install Apache Geronimo server as a Windows service by running the following command:

<geronimo_home>\bin\service_pr.bat install

For example:
solid D:\geronimo-tomcat6-javaee5-2.2\bin>service_pr.bat install The service "geronimosrv" has been installed.

This will create a Geronimo service for the server with the name "geronimosrv" with default parameters. You can start/stop the Geronimo service using Windows' Services tool or by using <geronimo_home>\bin\geronimosrvw.exe tool.

...

By default the Geronimo service is be configured with "manual" startup type. Use Windows' Services tool or geronimosrvw.exe command to configure it to "automatic" if needed.

Default admin account "system" with password "manager" is used to shut down the service. Change this setting with the geronimosrvw.exe

...

tool (in the "Shutdown" tab) if the default admin account is changed.

For more help on how to use the geronimosrv.exe and geronimosrvw.exe command, refer to Apache Commons Daemon manual.

...

JAVA_OPTS and GERONIMO_OPTS environment variables are NOT read by the service_pr.bat script. If you need to add any options that shall be used to start/stop the service, you can use the geronimosrvw.exe tool to add them to the command line arguments in the "Startup" and/or "Shutdown" tab. You can also use the geronimosrv.exe command to do that.

For more help on how to use the geronimosrv.exe and geronimosrvw.exe command, refer to Apache Commons Daemon manual.

To remove the Apache Geronimo service run the following command:

<geronimo_home>\bin\service_pr.bat remove

For example:
solid D:

To remove the Apache Geronimo service run the following command:

<geronimo_home>\bin\service_pr.bat remove

For example:

...

bgColor#000000
borderStylesolid

...

\geronimo-tomcat6-javaee5-2.2\bin>service_pr.bat

...

remove

...

The

...

service

...

'geronimosrv'

...

has

...

been

...

removed.

...

 
 

Java Service Wrapper

A Java Service Wrapper will be required as an additional software to achieve this configuration. Using a service wrapper 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.

Software Prerequisites

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

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

Installing the Java Service Wrapper

Follow the instructions for installing Java Service Wrapper. Once you download the right version for your environment you 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<jsw_home>.

Installing the Java Service Wrapper

Follow the instictions for installing Java Service Wrapper. Once you download the right version for your environment you 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>.

For this particular example we will try to locate all the wrapper related files within the Geronimo directory For this particular example we will try to locate all the wrapper related files within the Geronimo directory structure, so we will have to copy some files over.

Once you install the wrapper, copy these the items as indicated in the following table.

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.

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

...

to keep all the wrapper files within Geronimo's directory structure.

...

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.

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

...

You should see a screen similar to the following example, note that part has been truncated for display purposes.

...


...

solid

...

{D:\geronimo-tomcat6-javaee5-2.2\bin>g_service.bat

...

wrapper

...

|

...

-->

...

Wrapper

...

Started

...

as

...

Console

...

wrapper

...

|

...

Launching

...

a

...

JVM...

...

jvm

...

1

...

|

...

Wrapper

...

(Version

...

3.2.3)

...

http://wrapper.tanukisoftware.org

...

jvm

...

1

...

|

...

Copyright

...

1999-2006

...

Tanuki

...

Software,

...

Inc.

...

All

...

Rights

...

Reserved.

...

jvm

...

1

...

|

...

jvm

...

1

...

|

...

Booting

...

Geronimo

...

Kernel

...

(in

...

Java

...

1.5.0_06)...

...

jvm

...

1

...

|

...

Starting

...

Geronimo

...

Application

...

Server

...

v2.2

...

jvm

...

1

...

|

...

jvm

...

1

...

|

...

[* ] 0% 0s Loading jvm 1 | [*- ] 0% 0s Loading org.apache.ge...

...

jvm

...

1

...

|

...

[*> ] 6% 0s Loading org.apache.ge...

...

...

...

jvm

...

1

...

|

...

[*********************************]

...

100%

...

19s

...

Startup

...

complete

...

jvm

...

1

...

|

...

Listening

...

on

...

Ports:

...

jvm

...

1

...

|

...

1050

...

127.0.0.1

...

CORBA

...

Naming

...

Service

...

jvm

...

1

...

|

...

1099

...

0.0.0.

...

0 RMI

...

Naming

...

jvm

...

1

...

|

...

1527

...

0.0.0.0

...

Derby

...

Connector

...

jvm

...

1

...

|

...

2001

...

127.0.0.1

...

OpenEJB

...

ORB

...

Adapter

...

jvm

...

1

...

|

...

4201

...

0.0.0.0

...

org.apache.geronimo.openejb.EjbDaemonGBean

...

jvm

...

1

...

|

...

4242

...

0.0.0.0

...

Remote

...

Login

...

Listener

...

jvm

...

1

...

|

...

6882

...

127.0.0.1

...

OpenEJB

...

ORB

...

Adapter

...

jvm

...

1

...

|

...

8009

...

0.0.0.0

...

Tomcat

...

Connector

...

AJP

...

jvm

...

1

...

|

...

8080

...

0.0.0.0

...

Tomcat

...

Connector

...

HTTP

...

jvm

...

1

...

|

...

8443

...

0.0.0.0

...

Tomcat

...

Connector

...

HTTPS

...

jvm

...

1

...

|

...

9999

...

0.0.0.0

...

JMX

...

Remoting

...

Connector

...

jvm

...

1

...

|

...

61613

...

0.0.0.0

...

ActiveMQ

...

Transport

...

Connector

...

jvm

...

1

...

|

...

61616

...

0.0.0.0

...

ActiveMQ

...

Transport

...

Connector

...

jvm

...

1

...

|

...

jvm

...

1

...

|

...

Started

...

Application

...

Modules:

...

jvm

...

1

...

|

...

EAR:

...

org.apache.geronimo.configs/webconsole-tomcat/2.2/car

...

jvm

...

1

...

|

...

RAR:

...

org.apache.geronimo.configs/activemq-ra/2.2/car

...

jvm

...

1

...

|

...

RAR:

...

org.apache.geronimo.configs/system-database/2.2/car

...

jvm

...

1

...

|

...

WAR:

...

org.apache.geronimo.configs/dojo-tomcat/2.2/car

...

jvm

...

1

...

|

...

WAR:

...

org.apache.geronimo.configs/remote-deploy-tomcat/2.2/car

...

jvm

...

1

...

|

...

WAR:

...

org.apache.geronimo.configs/welcome-tomcat/2.2/car

...

jvm

...

1

...

|

...

jvm

...

1

...

|

...

Web

...

Applications:

...

jvm

...

1

...

|

...

http://localhost:8080/

...

jvm

...

1

...

|

...

http://localhost:8080/console

...

jvm

...

1

...

|

...

http://localhost:8080/console-standard

...

jvm

...

1

...

|

...

http://localhost:8080/dojo

...

jvm

...

1

...

|

...

http://localhost:8080/remote-deploy

...

jvm

...

1

...

|

...

jvm

...

1

...

|

...

Geronimo

...

Application

...

Server

...

started

...

 

Congratulations!!! you have now Geronimo server running as a Windows service.

The next step is to actually install the service so it can be picked up at Windows start time as well as managed along with the other existing services.

Installing/Removing the service

The following two batch files are provided to install and remove Geronimo as a Windows service. Create the files in the <geronimo_home>/bin directory and copy the content as depicted in the following examples.

...

...

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

...

You should get a confirmation screen similar to this example.

...

bgColor#000000
borderStylesolid

...

example.
solid D:\geronimo-tomcat6-javaee5-2.2\bin>Install_Geronimo_NT.bat

...

wrapper

...

|

...

Apache

...

Geronimo

...

v2.2

...

Server

...

installed.

...

 

...

To remove the Apache Geronimo service run the following command:

...

You should get a confirmation screen similar to this example.

...


...

solid

...

D:\geronimo-tomcat6-javaee5-2.2\bin>Uninstall_Geronimo_NT.bat

...

wrapper

...

|

...

Apache

...

Geronimo

...

v2.2

...

Server

...

removed.

...