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

Failed to create Guice container from all the plugins

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

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

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link 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)

            Show
            scm_issue_link 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)
            Hide
            jglick 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.

            Show
            jglick 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.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            dogfood 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
            Show
            dogfood 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
            Hide
            scm_issue_link 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)

            Show
            scm_issue_link 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)

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: