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

Failed to create Guice container from all the plugins

      Started a fresh installation of 1.580.1 and asked to install the three Jenkow plugins. After restart Jenkins would not come up.

          [JENKINS-25440] Failed to create Guice container from all the plugins

          Jesse Glick created issue -
          Jesse Glick made changes -
          Labels Original: classloader startup New: classloader robustness startup

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/ExtensionFinder.java
          http://jenkins-ci.org/commit/jenkins/22d433deae5e8e056f83900cc6c9bcc5a3ba60d5
          Log:
          So far unsuccessful attempt to make Jenkins startup more robust against bugs like JENKINS-25440.
          Even though SezpozModule.configure catches and ignores the faulty component, Guice still dies:
          … hudson.ExtensionFinder$GuiceFinder <init>
          SEVERE: Failed to create Guice container from all the plugins
          com.google.inject.internal.guava.collect.$ComputationException: java.lang.NoClassDefFoundError: org/eclipse/jgit/storage/file/FileRepository
          at …
          at com.google.inject.Guice.createInjector(Guice.java:73)
          at hudson.ExtensionFinder$GuiceFinder.<init>(ExtensionFinder.java:279)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/ExtensionFinder.java http://jenkins-ci.org/commit/jenkins/22d433deae5e8e056f83900cc6c9bcc5a3ba60d5 Log: So far unsuccessful attempt to make Jenkins startup more robust against bugs like JENKINS-25440 . Even though SezpozModule.configure catches and ignores the faulty component, Guice still dies: … hudson.ExtensionFinder$GuiceFinder <init> SEVERE: Failed to create Guice container from all the plugins com.google.inject.internal.guava.collect.$ComputationException: java.lang.NoClassDefFoundError: org/eclipse/jgit/storage/file/FileRepository at … at com.google.inject.Guice.createInjector(Guice.java:73) at hudson.ExtensionFinder$GuiceFinder.<init>(ExtensionFinder.java:279)

          Jesse Glick added a comment -

          Also reproducible by putting org.apache.sshd:sshd-core:1.0.0 in the classpath of a plugin and trying to run a functional test. In that case can be fixed by patching core as follows:

          diff --git a/core/src/main/java/hudson/ExtensionFinder.java b/core/src/main/java/hudson/ExtensionFinder.java
          index a2af086..2320e54 100644
          --- a/core/src/main/java/hudson/ExtensionFinder.java
          +++ b/core/src/main/java/hudson/ExtensionFinder.java
          @@ -63,6 +63,7 @@ import java.util.Collection;
           import java.lang.reflect.AnnotatedElement;
           import java.lang.reflect.Field;
           import java.lang.reflect.Method;
          +import java.util.Iterator;
           
           /**
            * Discovers the implementations of an extension point.
          @@ -299,6 +300,12 @@ public abstract class ExtensionFinder implements ExtensionPoint {
                       for (GuiceExtensionAnnotation<?> gea : extensionAnnotations.values()) {
                           Iterables.addAll(indices, Index.load(gea.annotationType, Object.class, classLoader));
                       }
          +            Iterator<IndexItem<?,Object>> it = indices.iterator();
          +            while (it.hasNext()) {
          +                if (it.next().className().startsWith("org.jenkinsci.main.modules.sshd.")) {
          +                    it.remove();
          +                }
          +            }
                       return ImmutableList.copyOf(indices);
                   }
           
          

          The error in SSHD itself is caught, and this binding is skipped. But the @Inject calls from PortAdvertiser and ItemListenerImpl remain.

          Jesse Glick added a comment - Also reproducible by putting org.apache.sshd:sshd-core:1.0.0 in the classpath of a plugin and trying to run a functional test. In that case can be fixed by patching core as follows: diff --git a/core/src/main/java/hudson/ExtensionFinder.java b/core/src/main/java/hudson/ExtensionFinder.java index a2af086..2320e54 100644 --- a/core/src/main/java/hudson/ExtensionFinder.java +++ b/core/src/main/java/hudson/ExtensionFinder.java @@ -63,6 +63,7 @@ import java.util.Collection; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; + import java.util.Iterator; /** * Discovers the implementations of an extension point. @@ -299,6 +300,12 @@ public abstract class ExtensionFinder implements ExtensionPoint { for (GuiceExtensionAnnotation<?> gea : extensionAnnotations.values()) { Iterables.addAll(indices, Index.load(gea.annotationType, Object .class, classLoader)); } + Iterator<IndexItem<?, Object >> it = indices.iterator(); + while (it.hasNext()) { + if (it.next().className().startsWith( "org.jenkinsci.main.modules.sshd." )) { + it.remove(); + } + } return ImmutableList.copyOf(indices); } The error in SSHD itself is caught, and this binding is skipped. But the @Inject calls from PortAdvertiser and ItemListenerImpl remain.
          Jesse Glick made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: jenkow-plugin [ 16925 ]
          Assignee Original: Max Spring [ m2spring ]
          Summary Original: Uninstallable in 1.580.1 New: Failed to create Guice container from all the plugins
          Jesse Glick made changes -
          Assignee New: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 2072 (Web Link)" [ 14010 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/ExtensionFinder.java
          http://jenkins-ci.org/commit/jenkins/1a2d82275c078ca3f651d9924a53acd2b6210a93
          Log:
          [FIXED JENKINS-25440] Recursively resolve @Inject’ed extensions, too, looking for LinkageError’s.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/ExtensionFinder.java http://jenkins-ci.org/commit/jenkins/1a2d82275c078ca3f651d9924a53acd2b6210a93 Log: [FIXED JENKINS-25440] Recursively resolve @Inject’ed extensions, too, looking for LinkageError’s.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: