Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Here is the original deployment descriptor for the datasources used for the Monitoring Plugin in <geronimo_home>\repository\org\apache\geronimo\plugins\monitoring\agent-ds\<version>\agent-ds-<version>.car\META-INF.

Code Block
xml
xml
titleplan.xmlxml
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-${geronimoSchemaVersion}">
    <environment>
        <moduleId>
            <groupId>${pom.groupId}</groupId>
            <artifactId>${pom.artifactId}</artifactId>
            <version>${version}</version>
            <type>car</type>
        </moduleId>
        <dependencies>
            <dependency>
                <groupId>org.apache.geronimo.configs</groupId>
                <artifactId>system-database</artifactId>
                <type>car</type>
            </dependency>
            <!-- SQL files -->
            <dependency>
                <groupId>org.apache.geronimo.plugins.monitoring</groupId>
                <artifactId>agent-sql</artifactId>
                <version>${monitoringConsoleVersion}</version>
                <type>jar</type>
            </dependency>
        </dependencies>
    </environment>

    <resourceadapter>
        <outbound-resourceadapter>
            <!-- Pool for Active Statistics -->
            <connection-definition>
                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>jdbc/ActiveDS</name>
                    <config-property-setting name="CreateDatabase">true</config-property-setting>
                    <config-property-setting name="Password">monitor</config-property-setting>
                    <config-property-setting name="UserName">monitor</config-property-setting>
                    <config-property-setting name="DatabaseName">ActiveMRCDB</config-property-setting>
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
             </connection-definition>
             <!-- Pool for Archived Statistics -->
             <connection-definition>
                 <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                 <connectiondefinition-instance>
                     <name>jdbc/ArchiveDS</name>
                     <config-property-setting name="CreateDatabase">true</config-property-setting>
                     <config-property-setting name="Password">monitor</config-property-setting>
                     <config-property-setting name="UserName">monitor</config-property-setting>
                     <config-property-setting name="DatabaseName">ArchiveMRCDB</config-property-setting>
                     <connectionmanager>
                         <local-transaction/>
                         <single-pool>
                             <max-size>10</max-size>
                             <min-size>0</min-size>
                             <match-one/>
                         </single-pool>
                     </connectionmanager>
                 </connectiondefinition-instance>
             </connection-definition>
         </outbound-resourceadapter>
     </resourceadapter>

     <!-- These two GBeans will create the tables for the database automatically -->
     <gbean name="ActiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
         <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
         <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
         <reference name="DataSource">
             <name>jdbc/ActiveDS</name>
         </reference>
     </gbean>
     <gbean name="ArchiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
         <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
         <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
         <reference name="DataSource">
             <name>jdbc/ArchiveDS</name>
         </reference>
     </gbean>
<!--this ought to be in the agent plan but this realm is not always started before the credential-store, even with the dependency-->
  <gbean name="monitoring-runas-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm">
    <attribute name="realmName">monitoring-runas-realm</attribute>
    <attribute name="global">false</attribute>
    <xml-reference name="LoginModuleConfiguration">
      <lc:login-config xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-1.2">
        <lc:login-module control-flag="REQUIRED">
          <lc:login-domain-name>monitoring-runas-domain</lc:login-domain-name>
          <lc:login-module-class>org.apache.geronimo.security.credentialstore.RunAsLoginModule</lc:login-module-class>
          <lc:option name="principalClass">org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal</lc:option>
          <lc:option name="principalNames">admin</lc:option>
        </lc:login-module>
      </lc:login-config>
    </xml-reference>
    <!--<reference name="ServerInfo">-->
    <!--<name>ServerInfo</name>-->
    <!--</reference>-->
  </gbean>
</connector>

...

  1. Create the deployment plan db2-agent-ds.xml based on the default plan.xml.
    Code Block
    xml
    xml
    titledb2-agent-ds.xmlxml
    <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
      <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <dep:moduleId>
          <dep:groupId>org.apache.geronimo.plugins.monitoring</dep:groupId>
          <dep:artifactId>db2-agent-ds</dep:artifactId>
          <dep:version>2.2</dep:version>
          <dep:type>car</dep:type>
        </dep:moduleId>
    
        <dep:dependencies>
          <dep:dependency>
            <dep:groupId>org.apache.geronimo.plugins.monitoring</dep:groupId>
            <dep:artifactId>agent-sql</dep:artifactId>
            <dep:version>2.2</dep:version>
            <dep:type>jar</dep:type>
          </dep:dependency>
          <dep:dependency>
            <dep:groupId>com.ibm.db2</dep:groupId>
            <dep:artifactId>db2jcc</dep:artifactId>
            <dep:version>9.5.0</dep:version>
            <dep:type>jar</dep:type>
          </dep:dependency>
          <dep:dependency>
            <dep:groupId>com.ibm.db2</dep:groupId>
            <dep:artifactId>db2jcc_license_cu</dep:artifactId>
            <dep:version>9.5.0</dep:version>
            <dep:type>jar</dep:type>
          </dep:dependency>
        </dep:dependencies>
    
        <dep:hidden-classes/>
        <dep:non-overridable-classes/>
        <dep:private-classes/>
      </dep:environment>
     
     <resourceadapter>
        <outbound-resourceadapter>
          <!--Pool for Active Statistics-->
          <connection-definition>
            <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
            <connectiondefinition-instance>
              <name>jdbc/ActiveDS</name>
    	   <config-property-setting name="UserName">db2admin</config-property-setting>
              <config-property-setting name="Password">db2manager</config-property-setting>
              <config-property-setting name="PortNumber">50000</config-property-setting>
              <config-property-setting name="ServerName">localhost</config-property-setting>
              <config-property-setting name="DatabaseName">activedb</config-property-setting>
              <config-property-setting name="DriverType">4</config-property-setting>          
              <connectionmanager>
                <xa-transaction>
                         <transaction-caching/>
                </xa-transaction>
    
                <single-pool>
                  <max-size>10</max-size>
                  <min-size>0</min-size>
                  <match-one/>
                </single-pool>
              </connectionmanager>
            </connectiondefinition-instance>
          </connection-definition>
          <!--Pool for Archived Statistics-->
          <connection-definition>
            <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
            <connectiondefinition-instance>
              <name>jdbc/ArchiveDS</name>
              <config-property-setting name="UserName">db2admin</config-property-setting>
              <config-property-setting name="Password">db2manager</config-property-setting>
              <config-property-setting name="PortNumber">50000</config-property-setting>
              <config-property-setting name="ServerName">localhost</config-property-setting>
              <config-property-setting name="DatabaseName">archdb</config-property-setting>
              <config-property-setting name="DriverType">4</config-property-setting>          
              <connectionmanager>
                <xa-transaction>
                         <transaction-caching/>
                </xa-transaction>
    
                <single-pool>
                  <max-size>10</max-size>
                  <min-size>0</min-size>
                  <match-one/>
                </single-pool>
              </connectionmanager>
            </connectiondefinition-instance>
          </connection-definition>
        </outbound-resourceadapter>
      </resourceadapter>
      <!--These two GBeans will create the tables for the database automatically-->
      <gbean name="ActiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
        <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
        <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
        <reference name="DataSource">
          <name>jdbc/ActiveDS</name>
        </reference>
      </gbean>
      <gbean name="ArchiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
        <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
        <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
        <reference name="DataSource">
          <name>jdbc/ArchiveDS</name>
        </reference>
      </gbean>
      <!--this ought to be in the agent plan but this realm is not always started before the credential-store, even with the dependency-->
      <gbean name="monitoring-runas-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm">
        <attribute name="realmName">monitoring-runas-realm</attribute>
        <attribute name="global">false</attribute>
        <xml-reference name="LoginModuleConfiguration">
          <lc:login-config xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-1.2">
            <lc:login-module control-flag="REQUIRED">
              <lc:login-domain-name>monitoring-runas-domain</lc:login-domain-name>
              <lc:login-module-class>org.apache.geronimo.security.credentialstore.RunAsLoginModule</lc:login-module-class>
              <lc:option name="principalClass">org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal</lc:option>
              <lc:option name="principalNames">admin</lc:option>
            </lc:login-module>
          </lc:login-config>
        </xml-reference>
        <!--<reference name="ServerInfo">-->
        <!--<name>ServerInfo</name>-->
        <!--</reference>-->
      </gbean>
    </connector>
    
    You have to make the following changes to db2-agent-ds.xml:
    • Update <dependencies> section with drivers required by DB2 Express-C.
    • Change the username and password for the datasource, and add ServerName and portnumber settings.
    • The DatabaseName for jdbc/ActiveDS is activedb, and the DatabaseName for jdbc/ArchiveDS is archdb.
  2. Similarly, create db2-mconsole-ds.xml. DatabaseName in this file is mcdb.
  3. Create the corresponding databases in DB2 Express-C: activedb, archdb and mcdb.
  4. Change var\config\config.xml for Geronimo to prevent the following modules from being launched at startup time. This can be done by adding a Load="false" to each module. This will prevent the configuration changes below from causing conflicts.
    • org.apache.geronimo.plugins.monitoring/agent-ds/2.2/car
    • org.apache.geronimo.plugins.monitoring/agent/2.2/car
    • org.apache.geronimo.plugins.monitoring/mconsole-ds/2.2/car
    • org.apache.geronimo.plugins.monitoring/mconsole-tomcat/2.2/car
  5. Start the server and deploy the plans using the deploy command.
    No Format
    deploy.bat deploy ..\repository\org\tranql\tranql-connector-db2-xa\1.3\tranql-connector-db2-xa-1.3.rar <plan_path>:\db2-agent-ds.xml
    deploy.bat deploy ..\repository\org\tranql\tranql-connector-db2-xa\1.3\tranql-connector-db2-xa-1.3.rar <plan_path>:\db2-mconsole-ds.xml
    
    where <plan_path> is the directory where your plans are placed.
  6. Shutdown the server and change var\config\artifact_aliases.properties file to replace default modules. In this way Geronimo will load DB2 datasources at startup time instead of the default ones.
    No Format
    org.apache.geronimo.plugins.monitoring/agent-ds/2.2/car=org.apache.geronimo.plugins.monitoring/db2-agent-ds/2.2/car 
    org.apache.geronimo.plugins.monitoring/mconsole-ds/2.2/car=org.apache.geronimo.plugins.monitoring/db2-mconsole-ds/2.2/car
    
  7. In var\config\config.xml, load org.apache.geronimo.plugins.monitoring/agent/2.2/car and org.apache.geronimo.plugins.monitoring/mconsole-tomcat/2.2/car at startup time. This can be done by removing the Load="false" for each module.