There are several alternatives available for installing and removing applicaitons:
- Geronimo Administration Console
- #Deployer tool (command line)
- #Hot deployment (command line)
When you package your application you may include the deployment plan within the package or not. At deployment time, Geronimo will look for the geronimo-web.xml and web.xml deployment plans (or geronimo-application.xml or geronimo-application-client.xml depending the type of application) in the WEB-INF directory within you packaged application. If Geronimo can not find those descriptors it will attempt to deploy the application using defaults. If using defaults fails you will have to provide a deployment plan either repackaged in the application or providing an external deployment plan, in the following sections we will discuss further these alternatives.
Geronimo Administration Console
To install a new application via the Geronimo Administration Console the Install New Applications portlet is available by selecting Deploy New on the Console Navigation menu on the left hand side. This portlet also allows you to start automatically the application right after it was deployed.
As mentioned before, for this example we will be using the simple JSP HelloWorld sample created in the Quick start - Apache Geronimo for the impatient section. This sample has already included in the package the deployment plans.
From the Install New Applications portlet click on Browse to specify the path to the HelloWorld.war in the Archive: section. Make sure the Start app after install checkbox is selected (by default is checked) and then click on Install.
You should see the " The application was successfully deployed.
" and " The application was successfully started.
" confirmation messages on the top of the portlet.
Another way to verify that the application has been successfully installed and started is by checking the Installed Web Applications portlet which is available by selecting Web App WARs on the Console Navigation menu on the left hand side. You should see the application listed as hello and with the status running.
Since the application we installed is HelloWold.WAR we use this portlet, when you install an EAR you would check the status using the Installed Application EARs portlet available by selecting Application EARs on the Console Navigation menu on the left hand side. The installation procedure is the same for both WAR and EAR applications.
To remove the applications through the Geronimo Administration Console you will use these last two portlets, either the Installed Web Applications or the Installed Application EARs portlets depending on the application to uninstall.
For our example, access the Installed Web Applications portlet and click on Uninstall for the Component Name listing sample.applications/HelloWorldApp/1.2/war
. This will stop the application first and then uninstall it. The confirmation message " Uninstalled application
" should be listed at the bottom of the portlet.
These are the basic steps for installing and uninstalling applications via de Geronimo Administration Console, the following two sections will focus on the command line options.
Deployer tool
The deployer tool will allow you, among other things, install and uninstall applications via a command line. In this section we will focus on just these two tasks for the sample application, the remaining functionality is fully covered in the Deployer tool section.
To deploy the HelloWorld.war sample application using the Deployer tool open a command line window and type the following command from the <geronimo_home>\bin directory:
deploy --user system --password manager deploy <app_home>\HelloWorld.war
If your application does not include the Geronimo specific deployment plan in the WEB-INF directory you can still, just like with the Geronimo Administration Console, specify it externally. You just need to add to the previous command the path and file name of the deployment plan.
deploy --user system --password manager deploy <app_home>\HelloWorld.war <deployment_plan_home>\plan.xml
Note that when specifying the deployment plan externally you can use any file name to identify that plan, there is no need to use the geronimo-XYZ.xml
form.
Once deployed you should see a confirmation message similar to this one:
D:\geronimo-1.2-Tomcat\bin>deploy --user system --password manager deploy \HelloWorld_1.2\HelloWorld.war
Using GERONIMO_BASE: D:\geronimo-1.2-Tomcat
Using GERONIMO_HOME: D:\geronimo-1.2-Tomcat
Using GERONIMO_TMPDIR: D:\geronimo-1.2-Tomcat\var\temp
Using JRE_HOME: C:\Java\jdk1.5.0_06\\jre
Deployed sample.applications/HelloWorldApp/1.2/war @
http://HC2T60P:8080/hello
As a difference from the deployment via de Geronimo Administration Console, using the command line tool you receive more information in the confirmation message. For instance you receive the Component Name (a.k.a. moduleId) and you also receive the context root and port where the application was deployed. This is very usefull when isntalling, testing and uninstalling several different applications where it would be hard to remember all these values.
Alternatively, if you have not yet packaged your application you could use the --inPlace option for deploying your application directly from the directory you are actually developing the application. This option is used to deploy this sample application in the [ Quick start - Apache Geronimo for the impatient] section.
In this case you would use this command from the <geronimo_home>\bin directory:
deploy --user system --password manager deploy --inplace <app_home>
The Deployer tool can also be used to list all the installed applications. The list-modules command allows you to list all the applications, it also lets you narrow down the query by asking for just the started or stopped applications. The list-modules command without additional parameter will list by default all the started applications.
To uninstall an application you may want to list it first to get the right Component Name (or moduleId). Run the following command from the <geronimo_home>\bin directory:
deploy --user system --password manager list-modules
You will receive a list similar as the one shown in the following example.
D:\geronimo-1.2-Tomcat\bin>deploy --user system --password manager list-modules
Using GERONIMO_BASE: D:\geronimo-1.2-Tomcat
Using GERONIMO_HOME: D:\geronimo-1.2-Tomcat
Using GERONIMO_TMPDIR: D:\geronimo-1.2-Tomcat\var\temp
Using JRE_HOME: C:\Java\jdk1.5.0_06\\jre
Found 42 modules
+ org.apache.geronimo.configs/activemq/1.2/car
+ org.apache.geronimo.configs/activemq-broker/1.2/car
+ org.apache.geronimo.configs/axis/1.2/car
+ org.apache.geronimo.configs/axis-deployer/1.2/car
+ org.apache.geronimo.configs/client-deployer/1.2/car
+ org.apache.geronimo.configs/connector-deployer/1.2/car
+ org.apache.geronimo.configs/dojo-tomcat/1.2/car @ http://HC2T60P:8080/dojo
+ org.apache.geronimo.configs/geronimo-gbean-deployer/1.2/car
+ org.apache.geronimo.configs/hot-deployer/1.2/car
+ org.apache.geronimo.configs/j2ee-deployer/1.2/car
+ org.apache.geronimo.configs/j2ee-security/1.2/car
+ org.apache.geronimo.configs/j2ee-server/1.2/car
+ org.apache.geronimo.configs/j2ee-system/1.2/car
+ org.apache.geronimo.configs/openejb/1.2/car
+ org.apache.geronimo.configs/openejb-deployer/1.2/car
+ org.apache.geronimo.configs/persistence-jpa10-deployer/1.2/car
+ org.apache.geronimo.configs/remote-deploy-tomcat/1.2/car @ http://HC2T60P:8080/remote-deploy
+ org.apache.geronimo.configs/rmi-naming/1.2/car
+ org.apache.geronimo.configs/sharedlib/1.2/car
+ org.apache.geronimo.configs/system-database/1.2/car
+ org.apache.geronimo.configs/tomcat/1.2/car
+ org.apache.geronimo.configs/tomcat-deployer/1.2/car
+ org.apache.geronimo.configs/transaction/1.2/car
+ org.apache.geronimo.configs/webconsole-tomcat/1.2/car
`-> framework.war @ http://HC2T60P:8080/console
`-> standard.war @ http://HC2T60P:8080/console-standard
+ org.apache.geronimo.configs/welcome-tomcat/1.2/car @ http://HC2T60P:8080/
+ sample.applications/HelloWorldApp/1.2/war @ http://HC2T60P:8080/hello
org.apache.geronimo.configs/ca-helper-tomcat/1.2/car
org.apache.geronimo.configs/client/1.2/car
org.apache.geronimo.configs/client-corba-yoko/1.2/car
org.apache.geronimo.configs/client-security/1.2/car
org.apache.geronimo.configs/client-system/1.2/car
org.apache.geronimo.configs/client-transaction/1.2/car
org.apache.geronimo.configs/directory/1.2/car
org.apache.geronimo.configs/j2ee-corba-yoko/1.2/car
org.apache.geronimo.configs/javamail/1.2/car
org.apache.geronimo.configs/ldap-realm/1.2/car
org.apache.geronimo.configs/online-deployer/1.2/car
org.apache.geronimo.configs/openejb-corba-deployer/1.2/car
org.apache.geronimo.configs/openjpa/1.2/car
org.apache.geronimo.configs/shutdown/1.2/car
org.apache.geronimo.configs/transformer-agent/1.2/car
org.apache.geronimo.configs/uddi-tomcat/1.2/car
Look for the sample.applications/HelloWorldApp/1.2/war
entry, thas is the value you will have to use when trying to uninstall the application.
To uninstall the application run the following command from the <geronimo_home>\bin diretory using the Component Name you identified while listing the modules.
deploy --user system --password manager undeploy sample.applications/HelloWorldApp/1.2/war
This command will first stop the runnning application and then uninstall it. You should see a confirmation message similar to this:
D:\geronimo-1.2-Tomcat\bin>deploy --user system --password manager undeploy sample.applications/HelloWorldApp/1.2/war
Using GERONIMO_BASE: D:\geronimo-1.2-Tomcat
Using GERONIMO_HOME: D:\geronimo-1.2-Tomcat
Using GERONIMO_TMPDIR: D:\geronimo-1.2-Tomcat\var\temp
Using JRE_HOME: C:\Java\jdk1.5.0_06\\jre
Module sample.applications/HelloWorldApp/1.2/war unloaded.
Module sample.applications/HelloWorldApp/1.2/war uninstalled.
Undeployed sample.applications/HelloWorldApp/1.2/war
In this example you have used the same tool with three different commands:
- deploy
- list-modules
- undeploy
These are not the only options and commands available for this tool, please visit the Tools and commands section for additional details.
Hot deployment
Apache Geronimo has support for Hot Deployment. This means that you can copy an application JAR file into the <geronimo_home>/deploy directory and the application will be deployed automatically. This will also work for uninstalling or refreshing applications previously deployed via this method. Alternatively, you may also copy the directory (umpacked) for the application module instead of copying a single JAR file.
Note that with this deployment method you have to include the deployment plan in the application package, this method does not support external deployment plans. Also note that applications deployed via the Deployer tool or the Geronimo Administratio Console will not be listed in the <geronimo_home>/deploy directory.
When you copy an application in the deploy directory, let's say HelloWorld.war, you will see a confirmation message in the console where Geronimo is running stating the application was deployed and the context to access that application.
16:26:49,453 INFO [Hot Deployer] Deploying HelloWorld.war
Deployed sample.applications/HelloWorldApp/1.1/war @
http://hc2t60p:8080/hello
To remove the application, just delete the WAR or EAR file from the deploy directory. When the application has been removed you should see a confirmation message in the console where Geronimo is running stating the application was undeployed.
16:30:03,796 INFO [Hot Deployer] Undeploying HelloWorld.war
16:30:04,015 INFO [DirectoryMonitor] Hot deployer notified that an artifact was removed: sample.applications/HelloWorldApp/1.1/war
Undeployed sample.applications/HelloWorldApp/1.1/war