File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Problem with unrecoverable key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem with unrecoverable key " Watch "Problem with unrecoverable key " New topic
Author

Problem with unrecoverable key

alex jamison
Greenhorn

Joined: Jun 10, 2009
Posts: 7
So i used wsdl2java to generate some java classes for my service calls. i put in a cert into the keystore with its public and private parts but when i run this i get the "unrecoverable key" exception... it happens when i use the generated code to invoke a call... any pointers on how to fix this or what the problem might be - generated code, config of cert/keystore etc?


System.setProperty("javax.net.ssl.keyStore","C:\\Program Files\\Java\\jdk1.6.0_07\\lib\\security\\keystore");
System.setProperty("javax.net.ssl.keyStorePassword","changeit");
URL endpoint = new java.net.URL("https://foo.bar/services/ingest);
ingestSoapBindingStub ingest = new ingestSoapBindingStub(endpoint,null);

/***********auto generated from wsdl2java************/
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("ingest");
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://ingest.webservice.foobar.com", "ingest"));
setRequestHeaders(_call);
setAttachments(_call);

try {
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {header}); //this call is causing error
.....}

I get the following error:

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(Unknown Source)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(Unknown Source)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92) .....

Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79)
... 45 more
Caused by: java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(Unknown Source)
at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(Unknown Source)
at java.security.KeyStore.getKey(Unknown Source)
... 53 more

{http://xml.apache.org/axis/}hostname:foo-bar

java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(Unknown Source)
... 42 more
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at java.security.Provider$Service.newInstance(Unknown Source)
... 45 more
Caused by: java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(Unknown Source)
at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source)

... 53 more



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with unrecoverable key
 
Similar Threads
Error in Calling Web service Through SSL
Need help with 403 error accessing webservice.
Getting CertificateParsingException while calling a webservice with SSL
Digital Signature (key)
problem calling a remote webservice [ Algo Error]