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

java.lang.NoClassDefFoundError if rabbitmq-consumer plugin is not installed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • gerrit-trigger-plugin
    • None
    • Jenkins 1.651.2
      Gerrit-trigger: 2.21.0

      I get the following exception in the the latest update of gerrit trigger plugin:

      Jun 02, 2016 7:38:09 PM com.sonymobile.tools.gerrit.gerritevents.GerritHandler notifyListener
      SEVERE: Exception thrown during event handling.
      java.lang.reflect.InvocationTargetException
                      at sun.reflect.GeneratedMethodAccessor471.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                      at java.lang.reflect.Method.invoke(Method.java:606)
                      at com.sonymobile.tools.gerrit.gerritevents.GerritHandler.notifyListener(GerritHandler.java:316)
                      at com.sonymobile.tools.gerrit.gerritevents.GerritHandler.notifyListeners(GerritHandler.java:296)
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.JenkinsAwareGerritHandler.notifyListeners(JenkinsAwareGerritHandler.java:77)
                      at com.sonymobile.tools.gerrit.gerritevents.workers.AbstractGerritEventWork.perform(AbstractGerritEventWork.java:46)
                      at com.sonymobile.tools.gerrit.gerritevents.workers.GerritEventWork.perform(GerritEventWork.java:48)
                      at com.sonymobile.tools.gerrit.gerritevents.workers.EventThread.run(EventThread.java:66)
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.SystemEventThread.run(SystemEventThread.java:66)
      Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.EventListener$ParametersActionInspection.<init>(EventListener.java:435)
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.EventListener.getParametersInspection(EventListener.java:391)
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.EventListener.createParameters(EventListener.java:269)
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.EventListener.schedule(EventListener.java:188)
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.EventListener.schedule(EventListener.java:164)
                      at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.EventListener.gerritEvent(EventListener.java:126)
                      ... 10 more
      Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
                      at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1376)
                      at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
                      at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      

      It looks like in the following commit the dependency to apache commons lang 3 was introduced:
      https://github.com/jenkinsci/gerrit-trigger-plugin/pull/285/files#diff-54e50e5c447d3a893fd786bd419ee8b4R46

      This dependency is resolved during build time via the rabbitmq-consumer plugin. Since this plugin is optional, the class will not be found if this plugin is not installed.
      There are now two possibilities to fix this (which is why I didn't create a pull request in the first place):

      1. Replace in class 'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.EventListener' the import 'org.apache.commons.lang3.StringUtils' with 'org.apache.commons.lang.StringUtils'. This class is available with core jenkins installation.
      2. Explicitely add apache commons-lang3 to the dependencies of gerrit trigger plugin to make sure it is always imported.

            rsandell rsandell
            felixw Felix Wohlfrom
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: