1
我在應用程序中使用駱駝和cxf。有一個新模塊具有彈性城堡依賴性org.bouncycastle:bcprov-jdk15on:jar:1.53
。加入這個模塊後,我開始變得異常運行時:cxf駱駝應用程序中的bouncycastle碰撞
21-Dec-2015 12:02:06.194 INFO [Camel (camel-1) thread #17 - seda://sp-tsm:handleEndServiceChangeNotification] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [org.bouncycastle.jcajce.provider.symmetric.PBEPKCS12$AlgParams]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.bouncycastle.jcajce.provider.symmetric.PBEPKCS12$AlgParams]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1335)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1321)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1203)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164)
at java.security.Provider$Service.getImplClass(Provider.java:1636)
at java.security.Provider$Service.newInstance(Provider.java:1592)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.security.Security.getImpl(Security.java:695)
at java.security.AlgorithmParameters.getInstance(AlgorithmParameters.java:146)
at sun.security.x509.AlgorithmId.decodeParams(AlgorithmId.java:121)
at sun.security.x509.AlgorithmId.<init>(AlgorithmId.java:114)
at sun.security.x509.AlgorithmId.parse(AlgorithmId.java:372)
at sun.security.pkcs.EncryptedPrivateKeyInfo.<init>(EncryptedPrivateKeyInfo.java:80)
at sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:321)
at java.security.KeyStore.getKey(KeyStore.java:1023)
at org.apache.wss4j.common.crypto.Merlin.getPrivateKey(Merlin.java:766)
at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:555)
at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:152)
at org.apache.wss4j.dom.handler.WSHandler.doSenderAction(WSHandler.java:237)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor.access$200(WSS4JOutCustomInterceptor.java:56)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor$WSS4JOutInterceptorInternal.handleMessageInternal(WSS4JOutCustomInterceptor.java:284)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutCustomInterceptor.java:156)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutCustomInterceptor.java:143)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425)
at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:153)
at org.apache.camel.impl.SynchronousDelegateProducer.process(SynchronousDelegateProducer.java:62)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:291)
at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:200)
at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
和
10:21:53.919 [Camel (camel-1) thread #7 - seda://sp-tsm:checkGlobalEligibility] ERROR c.t.w.c.r.ExceptionHandlingRoutes - Exchange[ExchangePattern: InOut, BodyType: org.globalplatform.namespaces.systems_messaging._2_1.CheckGlobalEligibilityRequestType, Body: org.globalplatform.name[email protected]29f83af2, CaughtExceptionType: org.apache.cxf.binding.soap.SoapFault,
CaughtExceptionMessage: Security processing failed.,
StackTrace: org.apache.cxf.binding.soap.SoapFault: Security processing failed.
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor$WSS4JOutInterceptorInternal.handleMessageInternal(WSS4JOutCustomInterceptor.java:292)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutCustomInterceptor.java:156)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutCustomInterceptor.java:143)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:418)
at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:116)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:291)
at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:200)
at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.wss4j.common.ext.WSSecurityException: Cannot create Crypto class org.apache.wss4j.common.crypto.Merlin
Original Exception was org.apache.wss4j.common.ext.WSSecurityException: Failed to load credentials.
Original Exception was java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: pad block corrupted
at org.apache.wss4j.common.crypto.CryptoFactory.getInstance(CryptoFactory.java:134)
at org.apache.wss4j.common.crypto.CryptoFactory.getInstance(CryptoFactory.java:203)
at org.apache.cxf.ws.security.wss4j.WSS4JUtils.loadCryptoFromPropertiesFile(WSS4JUtils.java:350)
at org.apache.cxf.ws.security.wss4j.AbstractWSS4JInterceptor.loadCryptoFromPropertiesFile(AbstractWSS4JInterceptor.java:207)
at org.apache.wss4j.dom.handler.WSHandler.loadCrypto(WSHandler.java:1096)
at org.apache.wss4j.dom.handler.WSHandler.loadSignatureCrypto(WSHandler.java:990)
at org.apache.wss4j.dom.handler.WSHandler.doSenderAction(WSHandler.java:142)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor.access$200(WSS4JOutCustomInterceptor.java:56)
at com.toro.wm.protocol.gpm.ws.interceptor.WSS4JOutCustomInterceptor$WSS4JOutInterceptorInternal.handleMessageInternal(WSS4JOutCustomInterceptor.java:284)
... 19 more
Caused by: org.apache.wss4j.common.ext.WSSecurityException: Failed to load credentials.
Original Exception was java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: pad block corrupted
at org.apache.wss4j.common.crypto.Merlin.load(Merlin.java:409)
at org.apache.wss4j.common.crypto.Merlin.loadProperties(Merlin.java:225)
at org.apache.wss4j.common.crypto.Merlin.<init>(Merlin.java:161)
at org.apache.wss4j.common.crypto.CryptoFactory.getInstance(CryptoFactory.java:129)
... 27 more
Caused by: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: pad block corrupted
at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1978)
at java.security.KeyStore.load(KeyStore.java:1445)
at org.apache.wss4j.common.crypto.Merlin.load(Merlin.java:403)
... 30 more
Caused by: javax.crypto.BadPaddingException: pad block corrupted
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$BufferedGenericBlockCipher.doFinal(Unknown Source)
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(Unknown Source)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1969)
... 32 more
BouncyCastle的應用程序中,不使用其他任何地方。 CXF版本是3.0.6。
因此,似乎CXF和bouncycastle在某種程度上不能很好地協同工作(至少在我的情況下)。我該如何解決這個問題?