Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UnrecoverableKeyException: Cannot recover key - need help figuring out....

843811Sep 17 2010 — edited Apr 11 2011
  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
 
{code}
So basically I have the keystore in there with my personal public and private key. The truststore doesnt seem to be needed as i get the same exact error when i do include it. i searched around and it seems others dont use the generated code and am not sure how to fix this.... am i missing something else in my keystores or it is something else? thanks!

Edited by: shaselai on Sep 17, 2010 1:32 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2011
Added on Sep 17 2010
8 comments
25,219 views