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

          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.

          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.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          core/src/main/java/hudson/ExtensionFinder.java
          http://jenkins-ci.org/commit/jenkins/290af8dd1f196815c703a1761fc8a884516f2879
          Log:
          JENKINS-25440 Merged #2072.

          Compare: https://github.com/jenkinsci/jenkins/compare/ec95aa5b21ab...290af8dd1f19

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/hudson/ExtensionFinder.java http://jenkins-ci.org/commit/jenkins/290af8dd1f196815c703a1761fc8a884516f2879 Log: JENKINS-25440 Merged #2072. Compare: https://github.com/jenkinsci/jenkins/compare/ec95aa5b21ab...290af8dd1f19

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4480
          [FIXED JENKINS-25440] Recursively resolve @Inject’ed extensions, too, (Revision 1a2d82275c078ca3f651d9924a53acd2b6210a93)

          Result = SUCCESS
          jesse glick : 1a2d82275c078ca3f651d9924a53acd2b6210a93
          Files :

          • core/src/main/java/hudson/ExtensionFinder.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4480 [FIXED JENKINS-25440] Recursively resolve @Inject’ed extensions, too, (Revision 1a2d82275c078ca3f651d9924a53acd2b6210a93) Result = SUCCESS jesse glick : 1a2d82275c078ca3f651d9924a53acd2b6210a93 Files : core/src/main/java/hudson/ExtensionFinder.java

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

          (cherry picked from commit 1a2d82275c078ca3f651d9924a53acd2b6210a93)

          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/9ea9761adc9abc52c4d979f7383ccb595b5ca32c Log: [FIXED JENKINS-25440] Recursively resolve @Inject’ed extensions, too, looking for LinkageError’s. (cherry picked from commit 1a2d82275c078ca3f651d9924a53acd2b6210a93)

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

              Created:
              Updated:
              Resolved: