java.lang.NoClassDefFoundError: org/bouncycastle/asn1/pkcs/PrivateKeyInfo

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.NoClassDefFoundError: org/bouncycastle/asn1/pkcs/PrivateKeyInfo

jaybytez
Does CXF 2.4.1 have a dependency on a bouncycastle library?

The reason I ask is that we are running CXF 2.4.1 web services on a WLS 11 RHEL 5.5 machine with JDK 1.6.24 and in one environment my web services with digital signatures (via WSS4J) they work and then in my other environment it throws the following exception:

org.apache.cxf.interceptor.Fault: org/bouncycastle/asn1/pkcs/PrivateKeyInfo
        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:86) ~[cxf-rt-frontend-jaxws-2.2.12.jar:2.2.12]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:60) ~[cxf-rt-frontend-jaxws-2.2.12.jar:2.2.12]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) ~[na:1.6.0_24]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) ~[na:1.6.0_24]
        at java.util.concurrent.FutureTask.run(FutureTask.java:138) ~[na:1.6.0_24]
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) ~[cxf-api-2.2.12.jar:2.2.12]
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:111) [cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99) [cxf-rt-transports-http-2.2.12.jar:2.2.12]
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:431) [cxf-rt-transports-http-2.2.12.jar:2.2.12]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:186) [cxf-rt-transports-http-2.2.12.jar:2.2.12]
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) [cxf-rt-transports-http-2.2.12.jar:2.2.12]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) [cxf-rt-transports-http-2.2.12.jar:2.2.12]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103) [cxf-rt-transports-http-2.2.12.jar:2.2.12]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) [javax.servlet_1.0.0.0_2-5.jar:2.5]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) [cxf-rt-transports-http-2.2.12.jar:2.2.12]
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) [weblogic.jar:10.3.4.0]
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) [weblogic.jar:10.3.4.0]
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) [weblogic.jar:10.3.4.0]
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183) [weblogic.jar:10.3.4.0]
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717) [weblogic.jar:10.3.4.0]
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) [weblogic.jar:10.3.4.0]
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1]
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0]
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) [weblogic.jar:10.3.4.0]
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) [weblogic.jar:10.3.4.0]
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) [weblogic.jar:10.3.4.0]
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207) [com.bea.core.weblogic.workmanager_1.9.0.0.jar:1.9.0.0]
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:176) [com.bea.core.weblogic.workmanager_1.9.0.0.jar:1.9.0.0]
Caused by: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/pkcs/PrivateKeyInfo
        at org.bouncycastle.jce.provider.JDKKeyFactory.createPrivateKeyFromDERStream(Unknown Source) ~[bcprov-jdk15-1.43.jar:1.43.0]
        at org.bouncycastle.jce.provider.JDKKeyFactory$RSA.engineGeneratePrivate(Unknown Source) ~[bcprov-jdk15-1.43.jar:1.43.0]
        at java.security.KeyFactory.generatePrivate(KeyFactory.java:342) ~[na:1.6.0_24]
        at sun.security.pkcs.PKCS8Key.buildPKCS8Key(PKCS8Key.java:169) ~[na:1.6.0_24]
        at sun.security.pkcs.PKCS8Key.parseKey(PKCS8Key.java:117) ~[na:1.6.0_24]
        at sun.security.provider.KeyProtector.recover(KeyProtector.java:319) ~[na:1.6.0_24]
        at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:121) ~[na:1.6.0_24]
        at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:38) ~[na:1.6.0_24]
        at java.security.KeyStore.getKey(KeyStore.java:763) ~[na:1.6.0_24]
        at org.apache.ws.security.components.crypto.CryptoBase.getPrivateKey(CryptoBase.java:216) ~[wss4j-1.5.8.jar:1.5.8]
        at org.apache.ws.security.message.WSSecSignature.computeSignature(WSSecSignature.java:713) ~[wss4j-1.5.8.jar:1.5.8]
        at org.apache.ws.security.message.WSSecSignature.build(WSSecSignature.java:780) ~[wss4j-1.5.8.jar:1.5.8]
        at org.apache.ws.security.action.SignatureAction.execute(SignatureAction.java:57) ~[wss4j-1.5.8.jar:1.5.8]
        at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:202) ~[wss4j-1.5.8.jar:1.5.8]
        at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.access$200(WSS4JOutInterceptor.java:50) ~[cxf-rt-ws-security-2.3.3.jar:2.3.3]
        at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:257) ~[cxf-rt-ws-security-2.3.3.jar:2.3.3]
        at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:134) ~[cxf-rt-ws-security-2.3.3.jar:2.3.3]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) ~[cxf-api-2.2.12.jar:2.2.12]
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) ~[cxf-rt-frontend-simple-2.2.12.jar:2.2.12]
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) ~[cxf-rt-frontend-jaxws-2.2.12.jar:2.2.12]
        at $Proxy2132.addCustomerContact(Unknown Source) ~[na:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]
        at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at com.foo.policy.ParameterValidationInterceptor.invoke(ParameterValidationInterceptor.java:31) ~[t3-svc-frmwrk-1.2.0-SNAPSHOT.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at com.foo.policy.TimerPolicyInterceptor.invoke(TimerPolicyInterceptor.java:31) ~[t3-svc-frmwrk-1.2.0-SNAPSHOT.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at $Proxy2133.addCustomerContact(Unknown Source) ~[na:na]
        at com.foo.dms.CustomerContactAccessServiceImpl.addCustomerContact(CustomerContactAccessServiceImpl.java:57) ~[customer-contact-svc-impl-1.2.0-SNAPSHOT.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]
        at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) ~[spring-tx-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at com.foo.policy.ParameterValidationInterceptor.invoke(ParameterValidationInterceptor.java:31) ~[t3-svc-frmwrk-1.2.0-SNAPSHOT.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at com.foo.policy.TimerPolicyInterceptor.invoke(TimerPolicyInterceptor.java:31) ~[t3-svc-frmwrk-1.2.0-SNAPSHOT.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) ~[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
        at $Proxy2135.addCustomerContact(Unknown Source) ~[na:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]
        at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]
        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89) ~[cxf-rt-core-2.2.12.jar:2.2.12]
        ... 31 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297) ~[com.bea.core.utils.classloaders_1.8.0.0.jar:1.8.0.0]
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270) ~[com.bea.core.utils.classloaders_1.8.0.0.jar:1.8.0.0]
        at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64) ~[com.bea.core.utils.classloaders_1.8.0.0.jar:1.8.0.0]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307) ~[na:1.6.0_24]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ~[na:1.6.0_24]
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179) ~[com.bea.core.utils.classloaders_1.8.0.0.jar:1.8.0.0]
        at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43) ~[com.bea.core.utils.classloaders_1.8.0.0.jar:1.8.0.0]
        ... 94 common frames omitted
2011-08-17 20:17:01,140 [[ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO org.apache.cxf.interceptor.LoggingOutInterceptor - Outbound Message
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/pkcs/PrivateKeyInfo

jaybytez
This got even more weird. My service war includes bcprov-jdk16-1.43.jar which has this class.
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/pkcs/PrivateKeyInfo

Daniel  Kulp
Administrator
On Wednesday, August 17, 2011 10:00:18 PM jaybytez wrote:
> This got even more weird. My service war includes bcprov-jdk16-1.43.jar
> which has this class.

Now that's interesting.....  Hmm....

You could TRY removing the bcprov jar entirely and it may work.   MOST of the
Algorithms and such needed are now built into the JDK, especially if you have
the unlimitted strength crypto stuff installed into the JDK.   Thus, you may
not needed.

The next thing to try is to stick wss4j and bcprov jars into WL's endorsed dir
so its picked up from there instead.  

Dan



> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/java-lang-NoClassDefFoundError-org-bouncyca
> stle-asn1-pkcs-PrivateKeyInfo-tp4710843p4710930.html Sent from the cxf-user
> mailing list archive at Nabble.com.
--
Daniel Kulp
[hidden email]
http://dankulp.com/blog
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/pkcs/PrivateKeyInfo

jaybytez
Thanks again.

This fixed it.  I removed all references to the bouncycastle jar and after deploying to WLS, the service worked.  So you were right, I no longer needed that jar.

Jay