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

Missing dependency on Job Config History plugin

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • mail-watcher-plugin
    • None

      A while ago we have uninstalled the Job config History plugin. We observed, that since then we don't get any notifications regarding node online status anymore. We have found in the logs:

      Failed to instantiate Key[type=org.jenkinsci.plugins.mailwatcher.WatcherComputerListener, annotation=[none]]; skipping this component
      java.lang.ClassNotFoundException: hudson.plugins.jobConfigHistory.JobConfigHistory
      	at java.base/java.net.URLClassLoader.findClass(Unknown Source)
      	at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
      	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      Caused: java.lang.NoClassDefFoundError: hudson/plugins/jobConfigHistory/JobConfigHistory
      	at org.jenkinsci.plugins.mailwatcher.MailWatcherMailer.<init>(MailWatcherMailer.java:67)
      	at org.jenkinsci.plugins.mailwatcher.WatcherComputerListener.<init>(WatcherComputerListener.java:57)
      	at org.jenkinsci.plugins.mailwatcher.WatcherComputerListener$$FastClassByGuice$$62ce4494.GUICE$TRAMPOLINE(<generated>)
      	at org.jenkinsci.plugins.mailwatcher.WatcherComputerListener$$FastClassByGuice$$62ce4494.apply(<generated>)
      	at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82)
      	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
      	at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:33)
      	at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:98)
      	at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
      	at hudson.ExtensionFinder$GuiceFinder$SezpozModule.onProvision(ExtensionFinder.java:610)
      	at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:117)
      	at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)
      	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:93)
      	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
      	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
      Caused: com.google.inject.ProvisionException: Unable to provision, see the following errors:
      
      1) [Guice/ErrorInjectingConstructor]: NoClassDefFoundError: hudson/plugins/jobConfigHistory/JobConfigHistory
        at WatcherComputerListener.<init>(WatcherComputerListener.java:56)
      
      Learn more:
        https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR
      
      1 error
      
      ======================
      Full classname legend:
      ======================
      WatcherComputerListener: "org.jenkinsci.plugins.mailwatcher.WatcherComputerListener"
      ========================
      End of classname legend:
      ========================
      
      	at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
      	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
      	at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
      	at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:445)
      	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
      	at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
      	at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:403)
      	at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:394)
      	at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:344)
      	at hudson.ExtensionList.load(ExtensionList.java:384)
      	at hudson.ExtensionList.ensureLoaded(ExtensionList.java:320)
      	at hudson.ExtensionList.iterator(ExtensionList.java:172)
      	at jenkins.util.Listeners.lambda$notify$0(Listeners.java:57)
      	at jenkins.util.Listeners.notify(Listeners.java:70)
      	at hudson.model.AbstractCIBase.updateComputerList(AbstractCIBase.java:278)
      	at jenkins.model.Jenkins.updateComputerList(Jenkins.java:1705)
      	at jenkins.model.Nodes$6.run(Nodes.java:351)
      	at hudson.model.Queue._withLock(Queue.java:1401)
      	at hudson.model.Queue.withLock(Queue.java:1275)
      	at jenkins.model.Nodes.load(Nodes.java:346)
      	at jenkins.model.Jenkins$12.run(Jenkins.java:3497)
      	at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
      	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
      	at jenkins.model.Jenkins$5.runTask(Jenkins.java:1170)
      	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
      	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
      	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.base/java.lang.Thread.run(Unknown Source)
      

      I think the Mail Watcher Plugin should depend on Job Config History Plugin.

          [JENKINS-72917] Missing dependency on Job Config History plugin

          It was designed to be optional dependency, but this was apparently broken in https://github.com/jenkinsci/mail-watcher-plugin/pull/43, which was intended to fix JENKINS-69831.  It replaced plugin("jobConfigHistory") with plugin(JobConfigHistory.class); now when mail-watcher-plugin attempts to check whether Job Config History has been installed, the check cannot even be executed without Job Config History.

          Kalle Niemitalo added a comment - It was designed to be optional dependency, but this was apparently broken in https://github.com/jenkinsci/mail-watcher-plugin/pull/43 , which was intended to fix JENKINS-69831 .  It replaced plugin("jobConfigHistory") with plugin(JobConfigHistory.class) ; now when mail-watcher-plugin attempts to check whether Job Config History has been installed, the check cannot even be executed without Job Config History.

          https://www.jenkins.io/doc/developer/plugin-development/optional-dependencies/ recommends calling Jenkins.getPlugin(String) to check whether the optional dependency has been installed.  That's what Mail Watcher used to do, but it also cast the result of this call to JobConfigHistory, which is apparently no longer possible.  The org.jenkinsci.plugins.mailwatcher.jobConfigHistory.ConfigHistory class doesn't really use the JobConfigHistory instance for anything though; it just checks whether the reference is null or not.  So, I think the dependency problem could be fixed pretty easily by reverting most of https://github.com/jenkinsci/mail-watcher-plugin/pull/43 and then changing the ConfigHistory constructor to take just a Boolean that indicates whether the plugin is present.

          Kalle Niemitalo added a comment - https://www.jenkins.io/doc/developer/plugin-development/optional-dependencies/ recommends calling Jenkins.getPlugin(String) to check whether the optional dependency has been installed.  That's what Mail Watcher used to do, but it also cast the result of this call to JobConfigHistory, which is apparently no longer possible.  The org.jenkinsci.plugins.mailwatcher.jobConfigHistory.ConfigHistory class doesn't really use the JobConfigHistory instance for anything though; it just checks whether the reference is null or not.  So, I think the dependency problem could be fixed pretty easily by reverting most of https://github.com/jenkinsci/mail-watcher-plugin/pull/43 and then changing the ConfigHistory constructor to take just a Boolean that indicates whether the plugin is present.

            Unassigned Unassigned
            amesser Andreas Messer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: