Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-75117

ClassNotFoundException for AWS CloudWatch classes

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • monitoring-plugin
    • Jenkins version: 2.479.2
      Monitoring plugin version: 2.4.0
      aws-java-sdk plugin version: 1.12.772-474.v7f79a_2046a_fb_
      Java version: OpenJDK 17

      The monitoring plugin fails to access AWS CloudWatch classes with the following error:

      java.lang.NoClassDefFoundError: com/amazonaws/services/cloudwatch/AmazonCloudWatchClientBuilder
      

      This occurs when JavaMelody attempts to publish metrics to CloudWatch (when -Djavamelody.cloudwatch-namespace is configured).

      The issue appears to be related to:

      • Jenkins core change in 2.479.2 (JENKINS-74814) which modified class loading behavior with RETAIN_CLASS_REFERENCE
      • The CloudWatch classes are present in aws-java-sdk plugin (1.12.772) but the monitoring plugin can't access them despite having aws-cloudwatch-library dependency in pom.xml

      Steps to Reproduce:

      • Install monitoring plugin 2.4.0
      • Install aws-java-sdk plugin
      • Configure JavaMelody with -Djavamelody.cloudwatch-namespace=your-namespace
      • Access Jenkins monitoring page

      Current Behavior:

      ClassNotFoundException when accessing monitoring page
      CloudWatch metrics are not published

      Expected Behavior:

      Monitoring plugin should successfully access AWS CloudWatch classes
      Metrics should be published to CloudWatch

          [JENKINS-75117] ClassNotFoundException for AWS CloudWatch classes

          Prankevich added a comment -

          I also have current problem. This issue not Reproduce in 1.99 version.

          Prankevich added a comment - I also have current problem. This issue not Reproduce in 1.99 version.

          Basil Crow added a comment - https://github.com/javamelody/aws-cloudwatch-library hasn't been updated in 8 years. Suggest adding CloudWatch to https://github.com/jenkinsci/aws-java-sdk-plugin / https://github.com/jenkinsci/aws-java-sdk2-plugin and switching https://github.com/jenkinsci/monitoring-plugin/blob/59be09431c0e98c370070f8b6c428c938f62fd59/pom.xml#L65-L82 to consume that.

          Basil Crow added a comment -

          yevhenzamburskyi artur Incremental build 2.5.0-rc548.0b_81b_a_0f7c37 is available for testing. To test this incremental build:

          1. Remove the unofficial aws-cloudwatch-library plugin, if installed.
          2. Install the latest version of the new official aws-java-sdk-cloudwatch plugin.
          3. Upgrade all installed plugins to the latest versions, including the apache-httpcomponents-client-4-api plugin.
          4. Download the incremental build from https://repo.jenkins-ci.org/incrementals/org/jvnet/hudson/plugins/monitoring/2.5.0-rc548.0b_81b_a_0f7c37/monitoring-2.5.0-rc548.0b_81b_a_0f7c37.hpi and install it as described in https://www.jenkins.io/doc/book/managing/plugins/#advanced-installation or via the Plugin Installation Manager Tool configuration monitoring:incrementals;org.jvnet.hudson.plugins;2.5.0-rc548.0b_81b_a_0f7c37

          Basil Crow added a comment - yevhenzamburskyi artur Incremental build 2.5.0-rc548.0b_81b_a_0f7c37 is available for testing. To test this incremental build: Remove the unofficial aws-cloudwatch-library plugin, if installed. Install the latest version of the new official aws-java-sdk-cloudwatch plugin. Upgrade all installed plugins to the latest versions, including the apache-httpcomponents-client-4-api plugin. Download the incremental build from https://repo.jenkins-ci.org/incrementals/org/jvnet/hudson/plugins/monitoring/2.5.0-rc548.0b_81b_a_0f7c37/monitoring-2.5.0-rc548.0b_81b_a_0f7c37.hpi and install it as described in https://www.jenkins.io/doc/book/managing/plugins/#advanced-installation or via the Plugin Installation Manager Tool configuration monitoring:incrementals;org.jvnet.hudson.plugins;2.5.0-rc548.0b_81b_a_0f7c37

            basil Basil Crow
            yevhenzamburskyi Yevhen
            Votes:
            6 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: