java.lang.IllegalStateException: Cannot open session, connection is not authenticated.

Jenkins JIRA | Raphaël Barrois | 3 years ago
  1. 0

    Hi, I've tried to switch to the next (unreleased) version of the Git plugin, in order to integrate with Jenkins credentials repository. I've selected: - Repository: git@github.com:ORG/PROJECT.git - Credentials: <A ssh deploy key linked to that project> - Git executable: JGit - Activate SSH Agent with the same credentials The SSH key isn't set as the "default key" of the Jenkins shell user on the server. As a result, Git SCM Polling, Github web hook and pre-build fetch fail. When I switch back to the "native" git executable, polling and web hook fail (as usual), but pre-build fetch succeed. Here is the stack trace I get: {code} Started by user anonymous Building remotely on kiso3 in workspace /home/jenkins/workspace/blusers [ssh-agent] Using credentials git (blusers) [ssh-agent] Looking for ssh-agent implementation... [ssh-agent] Java/JNR ssh-agent [ssh-agent] Started. Fetching changes from the remote Git repository FATAL: Cannot open session, connection is not authenticated. java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection.openSession(Connection.java:1102) at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:24) 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.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:342) at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) {code}

    Jenkins JIRA | 3 years ago | Raphaël Barrois
    java.lang.IllegalStateException: Cannot open session, connection is not authenticated.
  2. 0

    Hi, I've tried to switch to the next (unreleased) version of the Git plugin, in order to integrate with Jenkins credentials repository. I've selected: - Repository: git@github.com:ORG/PROJECT.git - Credentials: <A ssh deploy key linked to that project> - Git executable: JGit - Activate SSH Agent with the same credentials The SSH key isn't set as the "default key" of the Jenkins shell user on the server. As a result, Git SCM Polling, Github web hook and pre-build fetch fail. When I switch back to the "native" git executable, polling and web hook fail (as usual), but pre-build fetch succeed. Here is the stack trace I get: {code} Started by user anonymous Building remotely on kiso3 in workspace /home/jenkins/workspace/blusers [ssh-agent] Using credentials git (blusers) [ssh-agent] Looking for ssh-agent implementation... [ssh-agent] Java/JNR ssh-agent [ssh-agent] Started. Fetching changes from the remote Git repository FATAL: Cannot open session, connection is not authenticated. java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection.openSession(Connection.java:1102) at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:24) 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.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:342) at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) {code}

    Jenkins JIRA | 3 years ago | Raphaël Barrois
    java.lang.IllegalStateException: Cannot open session, connection is not authenticated.
  3. 0

    Cannot open session, connection is not authenticated

    GitHub | 2 years ago | galan
    java.lang.IllegalStateException: Cannot open session, connection is not authenticated.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.io.IOException: Publickey authentication failed.

    GitHub | 1 year ago | IvanAnishchuk
    java.lang.IllegalStateException: Cannot open session, connection is not authenticated.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Cannot open session, connection is not authenticated.

      at com.trilead.ssh2.Connection.openSession()
    2. Trilead
      Connection.openSession
      1. com.trilead.ssh2.Connection.openSession(Connection.java:1102)
      1 frame
    3. org.jenkinsci.plugins
      TrileadSession.exec
      1. org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:24)
      1 frame
    4. JGit - Core
      FetchCommand.call
      1. org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248)
      2. org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)
      3. org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
      4. org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
      5. org.eclipse.jgit.transport.Transport.fetch(Transport.java:1105)
      6. org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128)
      6 frames
    5. org.jenkinsci.plugins
      JGitAPIImpl.fetch
      1. org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:342)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3. java.lang.reflect.Method.invoke(Method.java:616)
      3 frames
    7. Hudson :: Remoting Layer
      InterceptingExecutorService$1.call
      1. hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299)
      2. hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
      3. hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
      4. hudson.remoting.UserRequest.perform(UserRequest.java:118)
      5. hudson.remoting.UserRequest.perform(UserRequest.java:48)
      6. hudson.remoting.Request$2.run(Request.java:326)
      7. hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      7 frames
    8. Java RT
      Thread.run
      1. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      2. java.util.concurrent.FutureTask.run(FutureTask.java:166)
      3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      5. java.lang.Thread.run(Thread.java:679)
      5 frames