You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 131 Next »

There are several alternatives available for Deploying and undeploying applications:

When you package your application, you might include the deployment plan within the package or not. At deployment time, Geronimo looks for the deployment plan (for example, geronimo-web.xml and deployment descriptor (for example,web.xml) in the WEB-INF directory within your packaged application. If Geronimo cannot find those information, it attempts to deploy the application using defaults. If using defaults fails, you will have to either provide a deployment plan repackaged in the application or provide an external deployment plan. In the following sections, we will discuss further these alternatives.

Via Geronimo Administration Console

To install a new application by using the Geronimo Administration Console, select Deployer on the Console Navigation menu on the left side to launch the Install Applications portlet. You can choose to start the application automatically right after it is deployed by selecting the start application after installation check box. This check box is selected by default.

For this example, we use the simple JSP HelloWorld sample that was created in the Quick start - Apache Geronimo for the impatient section. In that section, however, we used the --inPlace deployment option and did not need to package the application into a WAR file. To create the WAR file type, run the following command from the <app_home> directory:

jar -cvf HelloWorld.war *

This WAR has already included the deployment plans in the package.

Back in the Geronimo Administration Console, from the Install New Applications portlet, click Browse to specify the path to HelloWorld.war in the Archive: section. Make sure that the Start application after installation check box is selected and then click 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 is 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 side. You should see the application listed as hello and with the status running.

Because the application we installed is HelloWold.WAR, we use this Installed Web Applications portlet to verify the installation. When you install an EAR, you would check the status by using the Installed Application EARs portlet available by selecting Application EARs on the Console Navigation menu on the left side. The installation procedure is the same for both WAR and EAR applications.

To remove the applications by using the Geronimo Administration Console, use either the Installed Web Applications portlet or the Installed Application EARs portlets depending on the application to uninstall.

For our example, access the Installed Web Applications portlet and click Uninstall for the application that has the Component Name sample.applications/HelloWorldApp/1.0/war. This will stop the application 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 by using the Geronimo Administration Console. The following two sections will focus on the command line options.

Via hot deployment

Apache Geronimo has support for Hot Deployment, which means that you can copy an application JAR file into the <geronimo_home>/deploy directory and the application will be deployed automatically. This also works for uninstalling or refreshing applications previously deployed by using this method. Alternatively, you can also copy the directory (unpacked) 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 because this method does not support external deployment plans. Also note that applications deployed by using the Deployer tool or the Geronimo Administration Console are not listed in the <geronimo_home>/deploy directory.

When you copy an application into the deploy directory, for example HelloWorld.war, you will see a confirmation message in the geronimo.log, which is located in the <geronimo_home>/var/log directory.

11:45:23,500 INFO  [DirectoryHotDeployer] Deploying HelloWorld.war
11:45:23,953 INFO  [DirectoryHotDeployer] Deployed sample.applications/HelloWorldApp/1.0/war @ /hello

To remove the application, delete the WAR or EAR file from the deploy directory. When the application has been removed, you should see a confirmation message in the geronimo.log, which is located in the <geronimo_home>/var/log directory.

11:46:17,953 INFO  [DirectoryHotDeployer] Undeploying HelloWorld.war
11:46:18,281 INFO  [DirectoryMonitor] Hot deployer notified that an artifact was removed: sample.applications/HelloWorldApp/1.0/war
11:46:18,281 INFO  [DirectoryHotDeployer]     Undeployed sample.applications/HelloWorldApp/1.0/war

Via Deployer tool

You can use the deployer tool to install and uninstall applications by running a command line. In this section, we focuses 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 by 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 the path and file name of the deployment plan to the previous command.

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. You do not need to use the geronimo-XYZ.xml form. In our example, we do not need to specify any additional deployment plans because we have the Geronimo specific ones already included in the package.

After you deploy the application, you should see a confirmation message similar to the following one with the moduleID sample.applications/HelloWorldApp/1.0/war, which is assigned to this application within your deployment plan. The confirmation message is displayed in the command window, which is different from the case when you deploy by using the Geronimo Administration Console.

D:\geronimo-tomcat7-javaee6-3.0\bin>deploy --user system --password manager deploy \HelloWorld_1.0\HelloWorld.war
Using GERONIMO_BASE:   D:\geronimo-tomcat7-javaee6-3.0
Using GERONIMO_HOME:   D:\geronimo-tomcat7-javaee6-3.0
Using GERONIMO_TMPDIR: D:\geronimo-tomcat7-javaee6-3.0\var\temp
Using JRE_HOME:        C:\Java\jdk1.6.0_21\\jre
    Deployed sample.applications/HelloWorldApp/1.0/war @ /hello

Alternatively, if you have not yet packaged your application, you could use the --inPlace option for deploying your application directly from the directory where 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, use this command from the <geronimo_home>\bin directory:

deploy --user system --password manager deploy --inPlace <app_home>

To uninstall an application, run the following command from the <geronimo_home>\bin directory with the moduleID specified in the deployment plan.

deploy --user system --password manager undeploy sample.applications/HelloWorldApp/1.0/war

This command will stop the running application and then uninstall it. You should see a confirmation message similar to the following one:

D:\geronimo-tomcat7-javaee6-3.0\bin>deploy --user system --password manager undeploy sample.applications/HelloWorldApp/1.0/war
Using GERONIMO_BASE:   D:\geronimo-tomcat7-javaee6-3.0
Using GERONIMO_HOME:   D:\geronimo-tomcat7-javaee6-3.0
Using GERONIMO_TMPDIR: D:\geronimo-tomcat7-javaee6-3.0\var\temp
Using JRE_HOME:        C:\Java\jdk1.6.0_21\\jre
    Module sample.applications/HelloWorldApp/1.0/war unloaded.
    Module sample.applications/HelloWorldApp/1.0/war uninstalled.

    Undeployed sample.applications/HelloWorldApp/1.0/war

There are other options and commands available for this deployer tool, please visit the Tools and commands section for additional details.

Via gogo command

You can also deploy or undeploy applications in Karaf shell. See gogo commands for Geronimo for detailed information about deploying and undeploying gogo commands.

Via GEP

You can also deploy or undeploy application in Eclipse if you have Geronimo Eclipse Plugin (GEP) installed. See Deploying and debugging applications using GEP for details about deploying and undeploying applications with GEP.

Via Clustering

WADI can now be used to support the replication of HTTP Session state among multiple Geronimo servers. In previous releases of Geronimo, WADI could only be used along with the Jetty configuration of Geronimo. WADI can now be used with Tomcat configurations of Geronimo. In addition to the new session replication support, applications can now be deployed to administratively-defined groups of Geronimo servers. This makes it easier to manage a single application across a number of Geronimo servers. More information and details about clustered deployment can be found at Farming using Deployment.

  • No labels