Geronimo_MoinMoin_wiki > Running
Added by Confluence Administrator, last edited by Confluence Administrator on Aug 02, 2006

Contents

Setup

If you use Java**Server Pages then Geronimo (versions before M5) will need to have the Java Development Kit tools.jar file on its classpath. If you're using a Sun JDK then the easiest (although cheesiest) way to make this possible is to copy tools.jar from $JAVA_HOME/lib to $JAVA_HOME/jre/lib/ext.

There's also another way to work around the issue. Geronimo uses its own mechanism to discover the tools.jar file and once found adds it to CLASSPATH. Unless some prerequisities (will other JREs work?) aren't met, you won't have to make a copy of the file anymore.

Running Geronimo From Maven

The simplest way to deploy and run geronimo for a project that uses maven is to use the geronimo maven deploy plugin, installed when you build geronimo. It is convenient to have a separate module in your project to deal with installing and running your application in geronimo. It may also be convenient to have a module for running integration tests. OpenEJB includes an integration test running module, modules/itests: the maven.xml shows how to deploy and start geronimo, deploy your application, run tests, and shutdown geronimo. Here we will concentrate on how to start geronimo and deploy your application.

This maven.xml shows how to deploy in the target directory of your module:

  • <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <project default="installGeronimo"
        xmlns:ant="jelly:ant"
        xmlns:deploy="geronimo:deploy">
    
        <goal name="installGeronimo">
            <ant:delete dir="${maven.build.dir}/geronimo"/>
            <deploy:unpackServer
                geronimoVersion="1.0-SNAPSHOT"/>
        </goal>
    
    </project>
    
    

These additional properties provide more control: geronimoName=openejb will deploy the openejb server: this is build on the geronimo core but does not include a web server. targetDir specifies where geronimo will be deployed. The default is target/geronimo

This goal shows how to start the instance of geronimo you just deployed in the default target/geronimo directory:

  •     <goal name="startGeronimo">
            <deploy:startRemoteServer
                geronimoTarget="${maven.build.dir}/geronimo"
                configs="org/apache/geronimo/DebugConsole"/>
            <deploy:waitForStarted
                uri="deployer:geronimo:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
                username="system"
                password="manager"
                id="org/apache/geronimo/DebugConsole"/>
            <echo message="server has started"/>
        </goal>
    
    

configs in startRemoteServer may contain a space delimited list of configurations to start. Typically you will want to wait for the last one to start.

Note for Windows Users: If you are using a maven repository under c:\Documents and Settings\.maven the waitForStarted goal will fail. Please use a directory name without spaces instead.

This goal shows how to deploy your application in this running instance of geronimo;

  •     <goal name="startMyApp">
    
            <deploy:distribute
                uri="deployer:geronimo:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
                username="system"
                password="manager"
                home="${basedir}"
                module="${maven.repo.local}/myproject/jars/myapplication-1.0-SNAPSHOT.jar"
                />
            <deploy:start
                uri="deployer:geronimo:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
                username="system"
                password="manager"
                id="org/myproject/MyConfigurationName"/>
        </goal>
    
    

Here, org/myproject/MyConfigurationName is the configId specified in the geronimo-specific deployment descriptor or deployment plan.

In deploy:distribute you may include an external deployment plan

  • plan="path/to/external/plan.xml"
    

You can deploy and start any number of applications using goals similar to this.

This goal shows how to stop and undeploy your application:

  •     <goal name="stopMyApp">
            <deploy:stop
                uri="deployer:geronimo:jmx:rmi:///jndi/rmi://locahost:1099/JMXConnector"
                username="system"
                password="manager"
                id="org/myproject/MyConfigurationName"/>
            <ant:echo>undeploy</ant:echo>
            <deploy:undeploy
                uri="deployer:geronimo:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
                username="system"
                password="manager"
                id="org/myproject/MyConfigurationName"/>
        </goal>
    
    

This goal shows how to stop the geronimo server:

  •     <goal name="stopGeronimo">
            <deploy:stopRemoteServer
                uri="deployer:geronimo:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
                username="system"
                password="manager"/>
        </goal>
    

Running The Server From The Command Line

Using geronimo-assembly-1.0-SNAPSHOT.jar

If you've built from source, you must unpack the Geronimo binary $

Unknown macro: {maven.repo.local}
/geronimo/jars/geronimo-assembly-1.0-SNAPSHOT.jar into the location you wish to install Geronimo. For instance,

  • $ cd myproject
    $ jar -xf ~/.maven/repository/geronimo/jars/geronimo-assembly-1.0-SNAPSHOT.jar
    

(If you have installed a Milestone release then you should have an unpacked Geronimo directory already).

The Geronimo server is started using the executable jar file bin/server.jar.

  • $ java -jar bin/server.jar
    

To shutdown the server

  • $ java -jar bin/shutdown.jar
    

    The username is 'system' and the password is 'manager'.

There are some command-line flags that you can use to modify what gets output to the console:

  • java -jar server.jar --quiet      Very quiet startup, log level WARN.  Prior to the 1.0 release this option was -quiet.
    java -jar server.jar --long       Progress information without progress bar, log level WARN (Since 1.0 release)
    java -jar server.jar              Progress bar, server version, log level WARN
    java -jar server.jar -v           No progress, log level INFO
    java -jar server.jar -vv          No progress, log level DEBUG
    

The first time this is run, the default configurations will be started. When the server is shut down cleanly, the list of running configurations is saved. These will be reloaded automatically the next time the server is started.

Geronimo Console is available at http://localhost:8080/console. The user name is 'system' and the password is 'manager'.

For Advanced Users Only

It is possible to override this automatic restart mechanism by specifying one or more configuration names on the command line. For example, to start just the default configuration without any user applications use:

  • Milestone 3
    $ java -jar bin/server.jar org/apache/geronimo/Server
    

    SVN Head

    $ java -jar bin/server.jar org/apache/geronimo/RuntimeDeployer
    

So, specify as many configurations as you wish to have them started up in a Geronimo instance (but for any release after M3, make sure to include org/apache/geronimo/Unable to render embedded object: File (RuntimeDeployer in the list) not found.) Note that you must specify the --override option since the 1.0 release:

  • $ java -jar bin/server.jar --override <configuration1> <configuration2> ...
    

where configuration is taken from the Available configurations list.

Using the target of assembly module

Do the following to run the server from the target directory of the assembly module:

  • $> cd modules/assembly
    $> maven
    $> cd target/geronimo-1.0-SNAPSHOT
    $> java -jar bin/server.jar
    

Available configurations

Geronimo contains several pre-built configurations. They can be started from the command line by:

  • $ java -jar bin/deployer.jar start config/from/this/list
    

The plans for these configurations are available at GERONIMO_HOME/plan. For more information about the Gbeans running in each configuration, look at these plans.