Error "An ssh error occurred while querying for reviews." shown in Gerrit Reviews panel


We recently moved our JIRA instance to a new server on a different domain and network subnet. Everything appears to be working well with the exception of the Gerrit plug-in.

The error mentioned in the subject title now appears in the "Gerrit Reviews" panel for any issues.

I have done the following checks to confirm the configuration should be correct (in theory):

1. Added a new public ssh-key to the gerrit user account that is used for all ssh queries for the new JIRA instance.

2. Checked the ssh configuration is working by running the following command as user "jira" which is used by our JIRA instance:

ssh -p 29418 gerrituser@gerrit_server gerrit query --format TEXT message:TG-173

The above command works correctly and returns the open gerrit ticket TG-173 from our gerrit server.

3. Checked that I can download the URL for the above ticket from the gerrit server using 'wget'.

I've tried to run a grep through the atlassian log files, but couldn't see any relevant error messages for the ssh error to understand more deeply what might be failing in our configuration.

Since the original JIRA installation worked and we imported the database from the original JIRA installation, the problem could quite possibly be caused by this import process.

I have tried uninstalling Gerrit and re-installing it without success. I should note that when I did this, the Gerrit configuration dialog appeared to remember all previous settings, so I don't think the plug-in uninstall is comprehensively deleting associated data from the database.

Any pointers into how to solve this problem gratefully received.


3 answers

1 accepted

2 votes
Answer accepted

I managed to eventually find catalina.out and the following trace:

Caused by: com.jcraft.jsch.JSchException: invalid privatekey: /var/atlassian/application-data/jira/data/com/meetme/plugins/jira/gerrit/wcdma-git.picochip.com1299857170919082294.key
at com.jcraft.jsch.IdentityFile.<init>(
at com.jcraft.jsch.IdentityFile.newInstance(
at com.jcraft.jsch.IdentityFile.newInstance(
at com.jcraft.jsch.JSch.addIdentity(
at com.jcraft.jsch.JSch.addIdentity(
at com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh.SshConnectionImpl.<init>(

I checked the key file we had on record and discovered that it was in fact an RSA public key rather than the paired private key. Upon addressing this problem I am pleased to report that the Gerrit plugin is now working.

One further and important point to add. I have also checked the Gerrit sshd "site/log/sshd_log" file and can see that there are no access attempts being made from our JIRA instance which suggests that the Gerrit plugin is, for some unknown reason, not running or unable to connect outwardly on ssh.

Hi Liam,

to enable some logging, you will have to set the following level :

  • com.meetme = DEBUG
  • com.sonyericsson.hudson = DEBUG
  • com.jcraft = DEBUG

i suggest that you re-upload the Private key ( a private key with no password ) .. but you should have some more verbose output wiith the above mentioned level .

best regards

Thanks for the suggestion, Trey. I've done as suggested and enabled DEBUG for the above modules under the ViewLogging.jspa page.

However, I did not see any additional debug trace reported either under the 'Gerrit' tab in the GUI or in the atlassian-jira.log file.

Do I need to look somewhere else?

did you check catalin.out , websphere.log. atlassian-jira.log .. ?

you should see one of :

  • Connected:true
  • Connected:false
  • a stacktrace (when something is wrong)

here is the fulle name of the package : com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh

here is the code :

        try {
            client = new JSch();
            client.setHostKeyRepository(new BlindHostKeyRepository());
            connectSession = client.getSession(authentication.getUsername(), host, port);
            logger.debug("Connected: {}", connectSession.isConnected());
        } catch (JSchException ex) {
            throw new SshException(ex);

best regards;

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


247 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you