3 Replies Latest reply on Sep 18, 2013 4:57 AM by Jean-Frederic Clere

    Upgrading Tomcat plugin, metric names not updated

    Elias Ross Master

      I updated the RHQ Tomcat plugin on 4.5 to a newer version (basically 4.9), but it still is internally using the old metric names for the connector metrics for some reason. I know the newer one was deployed since I see the new jar file.

       

      The change was made after 4.5 here:

       

      commit e7d48240474fba87f1a3c4118de4618fd2c8b32d
      Author: John Mazzitelli <mazz@redhat.com>
      Date:   Mon Oct 15 18:22:32 2012 -0400
      
      
          [BZ 707349] applying community patch from Ken Rumer - see https://bugzilla.redhat.com/show_bug.cgi?id=707349#c13
      
      @@ -807,42 +816,42 @@
                   description="Resumes this connector" />
      
                <metric
      -            property="Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%:maxTime"
      +            property="Catalina:type=GlobalRequestProcessor,name=%name%:maxTime"
                   displayName="Maximum Request Time"
                   description="Maximum time it took to process a request."
                   units="milliseconds"
                   category="performance" />
      

       

      But even with the updated plugin, RHQ is still using the old names, so no metrics data is coming back.

       

      rhq@st11p01ad-rhq001 $ rhq-cli -f live.js 239103
      Remote server version is: 4.5.1 (c880f5a)
      Login successful
      239103 def 10480,10479,10478,10477,10476,10474,10473,10475 | Catalina:type=ThreadPool,name=%handler%%address%-%port%:maxThreads
      ,Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadCount,...
      

       

      I'm not sure what to do:

      0. Uninventory any old instances not using the new plugin?

      1. Uninventory all existing instances?

      2. Disable the plugin?

      3. Purge the plugin?

       

      Or if this is something that may require extra action somehow.

        • 1. Re: Upgrading Tomcat plugin, metric names not updated
          Elias Ross Master

          It seems that the upgrade failed in some way. By looking at the logs:

           

          2013-09-04 20:20:26,811 ERROR [org.rhq.enterprise.server.core.plugin.ProductPluginDeployer] Failed to register RHQ plugin file [file:/usr/local/rhq-server-4.5.1/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins/jopr-tomcat-plugin-4.9.0-SNAPSHOT.jar]
          javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: The property [name] marked as required in the configuration definition of [Tomcat Connector] has no attribute 'default'
                  at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                  at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                  at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                  at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
          

           

          so somehow the existing descriptor failed validation, hence no upgrade was performed. The code:

           

              private void updateResourcePluginConfiguration(Resource resource, ConfigurationDefinitionUpdateReport updateReport) {
                  Configuration pluginConfiguration = resource.getPluginConfiguration();
                  boolean modified = false;
                  @SuppressWarnings("unused")
                  int numberOfProperties = pluginConfiguration.getProperties().size();
                  ConfigurationTemplate template = updateReport.getConfigurationDefinition().getDefaultTemplate();
                  Configuration templateConfiguration = template.getConfiguration();
          
          
                  for (PropertyDefinition propertyDef : updateReport.getNewPropertyDefinitions()) {
                      if (propertyDef.isRequired()) {
                          Property templateProperty = templateConfiguration.get(propertyDef.getName());
                          if (templateProperty == null) {
                              throw new IllegalArgumentException("The property [" + propertyDef.getName()
                                  + "] marked as required in the configuration definition of ["
                                  + propertyDef.getConfigurationDefinition().getName() + "] has no attribute 'default'");
                          } else {
                              pluginConfiguration.put(templateProperty.deepCopy(false));
                              modified = true;
                          }
                      }
                  }
          

           

          So it seems there may be difficulty with users upgrading from the existing tomcat plugin.

           

          The solution seems to be to update the existing plugin to not require 'name' to be set:

           

          diff --git a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
          index 653736f..5a93a27 100644
          --- a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
          +++ b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
          @@ -734,16 +734,20 @@
                          <c:simple-property
                             name="name"
                             type="string"
          -                  readOnly="true" />
          +                  readOnly="true"
          +                  required="false" />
                          <c:simple-property
                             name="port"
                             type="string"
                             description="Port on which this connector is configured to listen."
          -                  readOnly="true" />
          +                  readOnly="true"
          +                  required="false"
          +                  />
                          <c:simple-property
                             name="handler"
                             type="string"
                             description="Connector protocol handler."
          +                  required="false"
                             readOnly="true" />    
                          <c:simple-property
                             name="connector"
          

           

          I did the other properties just to be sure. I don't fully understand this, but it does seem like a bug.

          • 2. Re: Upgrading Tomcat plugin, metric names not updated
            Thomas Segismont Expert

            Hi Elias,

             

            Nice catch. I created a bug report (Bug 1005095 - Upgrading Tomcat plugin, metric names not updated) and will try to get this fixed ASAP.

             

            Thanks

            • 3. Re: Upgrading Tomcat plugin, metric names not updated
              Jean-Frederic Clere Master

              In Tomcat there is nothing mandatory... Only the port is need (otherwise it uses 0 and the connector doesn't listen).