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

Compare with Current View Page History

« Previous Version 4 Next »

Overview

The Geronimo deployment plan for an enterprise application, which is usually packaged as a EAR file, is called "geronimo-application.xml". The geronimo-application.xml deployment plan is used in conjunction with the application.xml JAVA EE deplopyment plan to deploy enterprise applications consisting of Web Application WAR(s), EJB JAR(s), client application JAR(s), JCA connector JAR(s), and resource adapter module RAR(s) to the Geronimo application server. The geronimo-application.xml deployment plan is an optional file, but is typically used when deploying an EAR file. It is used to specify a moduleId for the deployed module, any third party dependencies, security options, and services.

Packaging

The geronimo-application.xml deployment plan can be packaged as follows:

  1. Embedded in an EAR file. In this case, a geronimo-application.xml file must be placed in the /META-INF directory of the EAR, which is the same place where the application.xml file must be located.
  2. Maintained separately from the EAR file. In this case, the path to the file must be provided to the appropriate Geronimo deployer (e.g., command-line or console). Note that in this case, the filename can be named something other than geronimo-application.xml but must adhere to the same schema.

Schema

The geronimo-application.xml deployment plan is defined by the geronimo-application-2.0.xsd schema located in the <geronimo_home>/schema/ subdirectory of the main Geronimo installation directory. The geronimo-application-2.0.xsd schema is briefly described here:

http://geronimo.apache.org/schemas-2.1/docs/geronimo-application-2.0.xsd.html

Top-level elements

The top-most element in the geronimo-application-2.0.xsd is <application> element. The top-level elements of the <application> element are described below:

<sys:environment>

The <sys:environment> elements use the Geronimo deployment namespace described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-module-1.2.xsd.html. The <sys:environment> contains the following elements:

  • The <moduleId> element is used to provide the configuration name for the web application as deployed in the Geronimo server. It contains elements for the groupId, artifactId, version and module type. Module IDs are normally printed with slashes between the four components, such as GroupID/ArtifactID/Version/Type.
  • The <dependencies> element is used to provide the configurations and third party libraries on which the web module is dependent upon. These configurations and libraries are made available to the web module via the Geronimo classloader hierarchy.
  • The <hidden-classes> element can be used to specify a list of classes which will never be loaded from parent ClassLoaders of this module. For example, if Log4J was listed here, the module would never see Geronimo's copy of Log4J. If the module provided it's own Log4J JAR it would use that, otherwise it would not be able to load Log4J at all.
  • The <non-overridable-classes> element can be used to specify a list of classes which will only be loaded from parent ClassLoaders of this module (never from the module's own ClassLoader). For example, this is used to prevent a web application from redefining "javax.servlet", so those classes will always be loaded from the server instead of from the web application's own ClassPath.
  • The <inverse-classloading> element can be used to specify that standard classloader delegation is to be reversed for this module.
  • The <suppress-default-environment> element can be used to suppress inheritance of environment by module (i.e., any default environment built by a Geronimo builder when deploying the plan will be suppressed).

An example geronimo-application.xml file is shown below using the <sys:environment> elements:

<sys:environment> example
<app:application
  xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
  xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
  xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
  application-name="SampleEAR">

    <dep:environment>

        <dep:moduleId>
            <dep:groupId>sampleear</dep:groupId>
            <dep:artifactId>sample-ear</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>ear</dep:type>
        </dep:moduleId>

        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>org.apache.geronimo.configs</dep:groupId>
                <dep:artifactId>tomcat6</dep:artifactId>
                <dep:version>2.2-SNAPSHOT</dep:version>
                <dep:type>car</dep:type>
            </dep:dependency>

            <dep:dependency>
                <dep:groupId>default</dep:groupId>
                <dep:artifactId>geronim-web-4</dep:artifactId>
                <dep:version>1.0</dep:version>
                <dep:type>car</dep:type>
            </dep:dependency>
        </dep:dependencies>

    </dep:environment>

</app:application>

<module>

The <module> uses the Geronimo default namespace for a geronimo-application.xml file that is described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-application-2.0.xsd.html. This element is used to define a single Java EE module and contains a connector, ejb, java, or web element, which indicates the module type. The <module> element also contains an optional <alt-dd> element that specifies an optional URI to the post-assembly version of the deployment descriptor file for a particular Java EE module. If <alt-dd> is not specified, the deployer must read the deployment descriptor from the default location and file name required by the respective component specification.

<ext-module>

The <ext-module> uses the Geronimo default namespace for a geronimo-application.xml file that is described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-application-2.0.xsd.html. This element can be used to define a single external Jave EE module that is being deployed or redeployed. The <ext-module> element also contains either an <internal-path> or an <external-path>. <internal-path> indicates that the module is packed in the EAR and the path specified is relative to the enterprise application package main directory. <external-path> indicates that the module is not part of the enterprise application and must be located by matching the supplied pattern in a Geronimo repository.

<sys:environment> example
<application 
  xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" 
  xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2" 
  application-name="MDBSampleEAR">

  <sys:environment>
    <sys:moduleId>
      <sys:groupId>default</sys:groupId>
      <sys:artifactId>MDBSampleEAR</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>car</sys:type>
    </sys:moduleId>
  </sys:environment>
  
  <ext-module>
    <connector>TopicJMSSample</connector>
    <external-path>
     <sys:groupId>org.apache.geronimo.modules</sys:groupId>
     <sys:artifactId>geronimo-activemq-ra</sys:artifactId>
     <sys:version>2.1</sys:version>
    </external-path>
    <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
     <resourceadapter>
      <!--how to connect to the JMS Server-->
      <resourceadapter-instance>
       <resourceadapter-name>TradeJMSResources</resourceadapter-name>
       <config-property-setting name="ServerUrl">tcp://localhost:61616</config-property-setting>
       <config-property-setting name="UserName">not needed</config-property-setting>
       <config-property-setting name="Password">not needed</config-property-setting>
       <workmanager>
        <gbean-link>DefaultWorkManager</gbean-link>
       </workmanager>
      </resourceadapter-instance>
        
      <!--defines a ConnectionFactory-->
      <outbound-resourceadapter>
       <connection-definition>
        <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
        <connectiondefinition-instance>
         <name>jms/TopicConnectionFactory</name>
         <implemented-interface>javax.jms.TopicConnectionFactory</implemented-interface>
         <connectionmanager>
          <xa-transaction>
           <transaction-caching/>
          </xa-transaction>
          <single-pool>
           <max-size>10</max-size>
           <min-size>0</min-size>
           <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
           <idle-timeout-minutes>0</idle-timeout-minutes>
           <match-one/>
          </single-pool>
         </connectionmanager>
        </connectiondefinition-instance>
       </connection-definition>
      </outbound-resourceadapter>
     </resourceadapter>
     <adminobject>
      <adminobject-interface>javax.jms.Topic</adminobject-interface>
      <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
      <adminobject-instance>
       <message-destination-name>TextMessageTopic</message-destination-name>
       <config-property-setting name="PhysicalName">TextMessageTopic</config-property-setting>
      </adminobject-instance>
     </adminobject>
    </connector>
  </ext-module>
</application>

<app:security>

The <app:security> uses the Geronimo applicaiton namespace described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-application-2.0.xsd.html. It is used to map roles specified in the EAR file to roles or principals in the security realm that will be used when deploying the module.

<sys:service>

The <sys:service> element uses the Geronimo deployment namespace described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-module-1.2.xsd.html. It is an empty generic element to be extended by GBean and other module types.

  • No labels