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

JGit+SSH fails with NullPointerException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: git-client-plugin
    • Labels:
      None
    • Environment:
      Windows 8 64bit
      Jenkins 1.509.2
      Git plugin 1.4.0
      Git client plugin 1.1.2
    • Similar Issues:

      Description

      1. Enable JGit
        • Add "JGit" to "Manage Jenkins">"Configure System">"Git"
      2. Configure a project with Git+SSH using JGit
        • Check "Git" in "Source Code Management"
        • Put "ssh://..." in "Repository URL"
        • Click "Advanced" just above "Repository Browser" (Not the one just below "Repository URL")
        • Select "jgit" for "Git executable"
      3. Run "Build Now"
      4. Build fails with following output:
        Using strategy: Default
        Cloning the remote Git repository
        [WARNING] JGit doesn't support reference repository. This flag is ignored.
        FATAL: null
        java.lang.NullPointerException
        	at org.jenkinsci.plugins.gitclient.trilead.TrileadSessionFactory.getSession(TrileadSessionFactory.java:31)
        	at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121)
        	at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248)
        	at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)
        	at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
        	at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
        	at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1105)
        	at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128)
        	at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:178)
        	at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:125)
        	at org.jenkinsci.plugins.gitclient.JGitAPIImpl$3.execute(JGitAPIImpl.java:643)
        	at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:57)
        	at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clone(JGitAPIImpl.java:98)
        	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1006)
        	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:942)
        	at hudson.FilePath.act(FilePath.java:904)
        	at hudson.FilePath.act(FilePath.java:877)
        	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:942)
        	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1108)
        	at hudson.model.AbstractProject.checkout(AbstractProject.java:1367)
        	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:674)
        	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
        	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:579)
        	at hudson.model.Run.execute(Run.java:1575)
        	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        	at hudson.model.ResourceController.execute(ResourceController.java:88)
        	at hudson.model.Executor.run(Executor.java:237)
        

        Attachments

          Issue Links

            Activity

            Hide
            ikedam ikedam added a comment -

            This is caused by JGitAPIImpl#provider is null for no one calls JGitAPIImpl#setCredentialsProvider nor JGitAPIImpl#setCredentials.
            Credentials can be registered in "Manage Jenkins">"Configure System">"Manage Credentials", but there seems no way to specify a credential to use.

            I verified that specifying proper Credential (e.g. fetch a one by CredentialsProvider#lookupCredentials) resolves the problem.

            The problem is:

            • The status of Git Client supporting JGit+SSH: JGit in Git Client is in development, so it may not yet be supported.
            • From when this problem occurs: JENKINS-18957 seems say that this does not happen in a proper version.
            • JGitAPIImpl#provider is cast to CredentialsProviderImpl in TrileadSessionFactory#getSession. This stands for I cannot avoid the problem by creating a subclass of CredentialsProvider and register it as a default for JGitAPIImpl#provider.
            Show
            ikedam ikedam added a comment - This is caused by JGitAPIImpl#provider is null for no one calls JGitAPIImpl#setCredentialsProvider nor JGitAPIImpl#setCredentials . Credentials can be registered in "Manage Jenkins">"Configure System">"Manage Credentials", but there seems no way to specify a credential to use. I verified that specifying proper Credential (e.g. fetch a one by CredentialsProvider#lookupCredentials ) resolves the problem. The problem is: The status of Git Client supporting JGit+SSH: JGit in Git Client is in development, so it may not yet be supported. From when this problem occurs: JENKINS-18957 seems say that this does not happen in a proper version. JGitAPIImpl#provider is cast to CredentialsProviderImpl in TrileadSessionFactory#getSession . This stands for I cannot avoid the problem by creating a subclass of CredentialsProvider and register it as a default for JGitAPIImpl#provider .
            Hide
            ikedam ikedam added a comment -

            I really want to use JGit, for git.exe in a Windows node running multiple at the same time often hangs up...

            Show
            ikedam ikedam added a comment - I really want to use JGit, for git.exe in a Windows node running multiple at the same time often hangs up...
            Hide
            tomhe Tomas Hellberg added a comment -

            @ikedam, we have the same problem for Windows slaves. Do you have any idea what is causing the hangs? We currently have to use a custom wrapper script with timeouts and retries to handle this, but it is very slow. I would also very much like a working JGit git client implementation.

            Show
            tomhe Tomas Hellberg added a comment - @ikedam, we have the same problem for Windows slaves. Do you have any idea what is causing the hangs? We currently have to use a custom wrapper script with timeouts and retries to handle this, but it is very slow. I would also very much like a working JGit git client implementation.
            Hide
            ikedam ikedam added a comment -

            @tomhe You are talking about git.exe in Windows?
            I'm not sure why it hangs...I gave up and I'm trying JGit now.

            Let's go to JENKINS-14046.
            I'll report my case there.
            And please let me know about your script if you wouldn't mind.

            Show
            ikedam ikedam added a comment - @tomhe You are talking about git.exe in Windows? I'm not sure why it hangs...I gave up and I'm trying JGit now. Let's go to JENKINS-14046 . I'll report my case there. And please let me know about your script if you wouldn't mind.
            Hide
            ndeloof Nicolas De Loof added a comment -

            support for credentials in git-client plugin has been designed with git-plugin 2.0 ("refactoring" branch) in mind, that let user define connection credentials using a specific extension.
            There is no plan to provide this feature on 1.x

            Show
            ndeloof Nicolas De Loof added a comment - support for credentials in git-client plugin has been designed with git-plugin 2.0 ("refactoring" branch) in mind, that let user define connection credentials using a specific extension. There is no plan to provide this feature on 1.x

              People

              Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              ikedam ikedam
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: