New issue
Advanced search Search tips

Issue 3084 link

Starred by 6 users

Issue metadata

Status: Released
Owner: ----
Closed: Feb 2015



Sign in to add a comment

java.lang.ClassNotFoundException: org.bouncycastle.openssl.PEMReader

Reported by zhongjie...@gmail.com, Jan 4 2015

Issue description

************************************************************
***** NOTE: THIS BUG TRACKER IS FOR GERRIT CODE REVIEW *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, INTERNAL *****
***** ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.    *****
***** THOSE ISSUE BELONG IN DIFFERENT ISSUE TRACKERS!  *****
************************************************************

Affected Version:2.9.4

What steps will reproduce the problem?
1.upgrade from 2.8.3 to 2.9.4
2.gerrit.sh start
3. start failed

What is the expected output? What do you see instead?
[2015-01-04 18:43:12,878] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.NoClassDefFoundError: org/bouncycastle/openssl/PEMReader
        at com.google.gerrit.sshd.HostKeyProvider.get(HostKeyProvider.java:75)
        at com.google.gerrit.sshd.HostKeyProvider.get(HostKeyProvider.java:31)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
        at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:73)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
        at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:63)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:107)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:107)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
        at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1059)
        at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:225)
        at com.google.gerrit.pgm.Daemon.createSshInjector(Daemon.java:394)
        at com.google.gerrit.pgm.Daemon.initSshd(Daemon.java:380)
        at com.google.gerrit.pgm.Daemon.start(Daemon.java:284)
        at com.google.gerrit.pgm.Daemon.run(Daemon.java:203)
        at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
        at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
        at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
        at Main.main(Main.java:25)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.openssl.PEMReader
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 58 more
                                                                                    


Please provide any additional information below.

 
Project Member

Comment 1 by huga...@gmail.com, Jan 7 2015

When you ran the init, did it downloaded the bouncycastle jars? Can you validate that you have those 2 jars in your [gerrit_site]/lib directory: bcpkix-jdk15on-149.jar  bcprov-jdk15on-149.jar
yes, It downloaded the two jars, I unzipped the two jars, there is no
PEMReader class in the two jars.
and I hvae tried install gerrot-2.9.4.war in a new server, it's ok
It looks like just there is a problem in the upgrade. I replace the two jar
with bcprov-jdk15-140.jar, then this problem is gone.
yes,I downloaded the two jars, I.have tried a new install in a new server,
it's ok. but this upgrade failed.
2015-1-7 下午10:18于 <gerrit@googlecode.com>写道:
On the upgraded server are the old bouncycastle jar files still in the $SITE/lib folder?

Comment 5 by tsu...@lagat.org, Feb 26 2015

I know this is old, but I had the same issue when upgrading to 2.11-rc0 and removing everything from $SITE/lib before initializing gerrit fixed it, so thanks, David.
Thanks for confirmation.  I'll look into how this can be improved.  At the very least, we can mention this in the release notes.

Status: ChangeUnderReview
https://gerrit-review.googlesource.com/#/c/65491/
Project Member

Comment 8 by edwin.ke...@gmail.com, Feb 27 2015

Labels: FixedIn-2.11
Status: Submitted
Status: Released
adding note for later reference:

1. 1st we upgrade from 2.8.1 to 2.9.1, and have  bcpkix-jdk15on-159.jar and bcprov-jdk15on-159.jar under lib dir, gerrit can start successfully.
2. we got following errors when upgrading from 2.9.1 to 2.10, 

 Bouncy Castle Crypto not installed; needed to read server host keys: [/home/gerrit2/review_site/etc/ssh_host_rsa_key, /home/gerrit2/review_site/etc/ssh_host_dsa_key]
  while locating com.google.gerrit.sshd.HostKeyProvider
  at com.google.gerrit.sshd.SshHostKeyModule.configure(SshHostKeyModule.java:26)
  while locating org.apache.sshd.common.KeyPairProvider
    for parameter 5 at com.google.gerrit.sshd.DatabasePubKeyAuth.<init>(DatabasePubKeyAuth.java:69)
  at com.google.gerrit.sshd.DatabasePubKeyAuth.class(DatabasePubKeyAuth.java:52)
  while locating com.google.gerrit.sshd.DatabasePubKeyAuth
  while locating org.apache.sshd.server.PublickeyAuthenticator
    for parameter 2 at com.google.gerrit.sshd.SshDaemon.<init>(SshDaemon.java:165)
  at com.google.gerrit.sshd.SshDaemon.class(SshDaemon.java:143)
  while locating com.google.gerrit.sshd.SshDaemon
  at com.google.gerrit.sshd.SshModule.configure(SshModule.java:70)
  while locating com.google.gerrit.server.ssh.SshInfo


The problem is gone after removing bcprov-jdk15on-159.jar under lib, we can start gerrit successfully.

Sign in to add a comment