com.sun.xml.wss.impl.misc.DefaultCallbackHandler$X509CertificateValidatorImpl
validate SEVERE: WSS1518: Failed to validate certificate
java.lang.NullPointerException: the keystore parameter must be
non-null at
java.security.cert.PKIXParameters.(PKIXParameters.java:145) at
java.security.cert.PKIXBuilderParameters.(PKIXBuilderParameters.java:130)
at
com.sun.xml.wss.impl.misc.DefaultCallbackHandler$X509CertificateValidatorImpl.validate(DefaultCallbackHandler.java:1646)
at
com.sun.xml.wss.impl.callback.CertificateValidationCallback.getResult(CertificateValidationCallback.java:87)
at
com.sun.xml.wss.impl.misc.DefaultSecurityEnvironmentImpl.validateCertificate(DefaultSecurityEnvironmentImpl.java:813)
at
com.sun.xml.ws.security.opt.impl.util.CertificateRetriever.setServerCertInTheContext(CertificateRetriever.java:397)
at
com.sun.xml.wss.jaxws.impl.SecurityTubeBase.initializeOutgoingProcessingContext(SecurityTubeBase.java:641)
at
com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientRequestPacket(SecurityClientTube.java:284)
at
com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:247)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136) at
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050) at
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019) at
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877) at
com.sun.xml.ws.rx.util.FiberExecutor.runSync(FiberExecutor.java:94)
at com.sun.xml.ws.rx.util.Communicator.send(Communicator.java:423) at
com.sun.xml.ws.rx.rm.runtime.ClientTube.sendSessionControlMessage(ClientTube.java:555)
at
com.sun.xml.ws.rx.rm.runtime.ClientTube.createSequences(ClientTube.java:415)
at
com.sun.xml.ws.rx.rm.runtime.ClientTube.openRmSession(ClientTube.java:338)
at
com.sun.xml.ws.rx.rm.runtime.ClientTube.processRequest(ClientTube.java:179)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136) at
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050) at
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019) at
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877) at
com.sun.xml.ws.client.Stub.process(Stub.java:464) at
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:174) at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:91)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154) at
com.sun.proxy.$Proxy47.getAvailableMessageInfo(Unknown Source)
当我尝试在Linux机器上使用证书时出现此错误,其中相同的证书在Windows上正常工作。在Linux上,我在Windows上使用jdk1.7.0_5版本的java,我们使用的是jdk1.7.0_03版本。这可能是导致此错误的可能原因还是导致此问题的其他原因?
答案 0 :(得分:-1)
Aug 19, 2014 8:01:09 AM com.sun.xml.wss.impl.misc.DefaultCallbackHandler$X509CertificateValidatorImpl validate
SEVERE: WSS1518: Failed to validate certificate
java.lang.NullPointerException: the keystore parameter must be non-null
at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:145)
at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:130)
at com.sun.xml.wss.impl.misc.DefaultCallbackHandler$X509CertificateValidatorImpl.validate(DefaultCallbackHandler.java:1646)
at com.sun.xml.wss.impl.callback.CertificateValidationCallback.getResult(CertificateValidationCallback.java:87)
at com.sun.xml.wss.impl.misc.DefaultSecurityEnvironmentImpl.validateCertificate(DefaultSecurityEnvironmentImpl.java:813)
at com.sun.xml.ws.security.opt.impl.util.CertificateRetriever.setServerCertInTheContext(CertificateRetriever.java:397)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.initializeOutgoingProcessingContext(SecurityTubeBase.java:641)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientRequestPacket(SecurityClientTube.java:284)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:247)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
at com.sun.xml.ws.rx.util.FiberExecutor.runSync(FiberExecutor.java:94)
at com.sun.xml.ws.rx.util.Communicator.send(Communicator.java:423)
at com.sun.xml.ws.rx.rm.runtime.ClientTube.sendSessionControlMessage(ClientTube.java:555)
at com.sun.xml.ws.rx.rm.runtime.ClientTube.createSequences(ClientTube.java:415)
at com.sun.xml.ws.rx.rm.runtime.ClientTube.openRmSession(ClientTube.java:338)
at com.sun.xml.ws.rx.rm.runtime.ClientTube.processRequest(ClientTube.java:179)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
at com.sun.xml.ws.client.Stub.process(Stub.java:464)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:174)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:91)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154)
at com.sun.proxy.$Proxy47.getAvailableMessageInfo(Unknown Source)
at com.jpmorgan.available.message.DealogicAvailableMessage.getAvailableDealMessageFromDealogic(DealogicAvailableMessage.java:29)
at com.jpmlink.deal.client.DealogicClient.main(DealogicClient.java:39)
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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
我确实从Web服务获得了响应,因为上述错误结束时忽略了未使用的证书
代码
加载证书
TempKeystoreTO TempKeystoreTO = TempHelper.getKeyStoreProperties();
KeyStore keyStore = KeyStore.getInstance(TempKeystoreTO.getFileType());
keyStore.load(new FileInputStream(TempKeystoreTO.getKeyStoreLocation()),TempKeystoreTO.getCertificatePassword().toCharArray());
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(TempKeystoreTO.getKeyStoreAlias(),new KeyStore.PasswordProtection(TempKeystoreTO.getCertificatePassword().toCharArray()));
X509Certificate certificate = (X509Certificate) privateKeyEntry.getCertificate();
keyStore.load(new FileInputStream(TempKeystoreTO.getTrustStoreLocation()),TempKeystoreTO.getCertificatePassword().toCharArray());
Certificate certificate1 = keyStore.getCertificate(TempKeystoreTO.getTrustStoreAlias());
((BindingProvider) ijpmLinkService).getRequestContext().put(XWSSConstants.CERTIFICATE_PROPERTY,certificate);
((BindingProvider) ijpmLinkService).getRequestContext().put(XWSSConstants.PRIVATEKEY_PROPERTY,privateKeyEntry.getPrivateKey());
((BindingProvider) ijpmLinkService).getRequestContext().put(XWSSConstants.PASSWORD_PROPERTY, TempKeystoreTO.getCertificatePassword());
((BindingProvider) ijpmLinkService).getRequestContext().put(XWSSConstants.SERVER_CERTIFICATE_PROPERTY, certificate1);
setProperties(TempKeystoreTO.getKeyStoreLocation(), TempKeystoreTO.getTrustStoreLocation(), TempKeystoreTO.getCertificatePassword());
List<Handler> handlerChain = new java.util.ArrayList<Handler>();
SOAPHandler handler = null;
if (service instanceof IJPMLinkService) {
handler = new DealogicMessageHandler();
}
handlerChain.add(handler);
Binding b = ((BindingProvider) service).getBinding();
b.setHandlerChain(handlerChain);
这在Windows + Solaris上完美运行但在Linux机器上抛出错误