title: SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received
body: <p>I am trying to consume a .NET web service from java client <strong>generated in JDeveloper</strong> IDE. 
  I have server and client certificates.  <strong>I successfully call this service in SoupUI, just by specifying *SSL Keystore=client_cert.pfx* for Request.</strong>
  I add server certificate to the java keystore by the following command:</p>
  
  <blockquote>
  <pre><code> keytool -import -alias client_alias -file client_cert.cer
        -keystore cacerts 
  </code></pre>
  </blockquote>
  
  <p>When I try to run my <strong>standalone java client</strong> I get 
  <strong>javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.</strong> </p>
  
  <p>Here is the stacktrace:</p>
  
  <blockquote>
    <p>jdk160_21\bin\javaw.exe -client
    -agentlib:jdwp=transport=dt_socket,server=y,address=49995 -classpath C:\JDeveloper\777\Application1.adf;C:\JDeveloper\777\Application1\Client\classes;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\oracle_common\modules\oracle.jrf_11.1.1\jrf.jar;C:\Oracle\Middleware\modules\com.oracle.toplink_1.0.0.0_11-1-1-4-0.jar;C:\Oracle\Middleware\modules\org.eclipse.persistence_1.0.0.0_2-1.jar;C:\Oracle\Middleware\modules\com.bea.core.antlr.runtime_2.7.7.jar;C:\Oracle\Middleware\oracle_common\modules\oracle.toplink_11.1.1\javax.persistence_2.0_preview.jar
    -Djavax.net.ssl.trustStore=C:\Oracle\Middleware\wlserver_10.3\server\lib\DemoTrust.jks
    -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888 -Dhttp.nonProxyHosts=&lt;-loopback>|localhost|localhost.localdomain|127.0.0.1|::1-Dhttps.proxyHost=127.0.0.1
    -Dhttps.proxyPort=8888 -Dhttps.nonProxyHosts=&lt;-loopback>|localhost|localhost.localdomain|127.0.0.1|::1|
    client.proxy.WSHttpBinding_IQueryServiceClient Listening for transport
    dt_socket at address: 49995 Debugger connected to local process.              
                    
                
                     
         
         
         
          
      
       
    
           
                   
       
                                            
              
                
     &lt;27042299 SSL3/TLS MAC>  
       &lt;27042299 received HANDSHAKE>     
       
            (Unknown Source)   at
    com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown
    Source)   at
    com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown
    Source)   at
    com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown
    Source)   at com.certicom.tls.record.ReadHandler.processRecord(Unknown
    Source)   at com.certicom.tls.record.ReadHandler.readRecord(Unknown
    Source)   at
    com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown
    Source)   at
    com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown
    Source)   at com.certicom.tls.record.WriteHandler.write(Unknown Source)
      at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)   at
    java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
      at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
      at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)    at
    weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:162)
      at
    weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:376)
      at
    weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
      at
    weblogic.net.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:720)
      at
    weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:980)
      at
    com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:215)
      at
    com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204)
      at
    com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124)
      at
    com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)    at
    com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815)  at
    com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778)   at
    com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680)     at
    com.sun.xml.ws.client.Stub.process(Stub.java:272)     at
    com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153)     at
    com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115)
      at
    com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)
      at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136)   at
    $Proxy34.getListForDropdown(Unknown Source)   at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)     at
    weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84)
      at $Proxy35.getListForDropdown(Unknown Source)  at
    client.proxy.WSHttpBinding_IQueryServiceClient.main(WSHttpBinding_IQueryServiceClient.java:66)</p>
    
    <blockquote>
      <p>      
          
      javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: FATAL
      Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was
      received.     at
      com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:218)
        at
      com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204)
        at
      com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124)
        at
      com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)    at
      com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815)  at
      com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778)   at
      com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680)     at
      com.sun.xml.ws.client.Stub.process(Stub.java:272)     at
      com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153)     at
      com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115)
        at
      com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136)   at
      $Proxy34.getListForDropdown(Unknown Source)   at
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)     at
      weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84)
        at $Proxy35.getListForDropdown(Unknown Source)  at
      client.proxy.WSHttpBinding_IQueryServiceClient.main(WSHttpBinding_IQueryServiceClient.java:66)
      Caused by: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE
      - A corrupt or unuseable certificate was received.    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknown
      Source)   at
      com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown
      Source)   at
      com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
      Source)   at
      com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown
      Source)   at
      com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown
      Source)   at
      com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown
      Source)   at com.certicom.tls.record.ReadHandler.processRecord(Unknown
      Source)   at com.certicom.tls.record.ReadHandler.readRecord(Unknown
      Source)   at
      com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown
      Source)   at
      com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown
      Source)   at com.certicom.tls.record.WriteHandler.write(Unknown Source)
        at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)   at
      java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
        at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)    at
      weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:162)
        at
      weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:376)
        at
      weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
        at
      weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:965)
        at
      com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:215)
        ... 20 more</p>
    </blockquote>
  </blockquote>
  
  <p><strong>Please help!</strong> Thanks for any advice you may have.</p>