Showing posts with label cxf. Show all posts
Showing posts with label cxf. Show all posts

Wednesday, 14 September 2011

java.security.UnrecoverableKeyException: Get Key failed: / by zero

I got this baby when my config like this on my conduit:
<sec:keyManagers >
   <sec:keyStore type="PKCS12" password="passwordForStore"
                  file="cert/key.pfx"/>
</sec:keyManagers>
  


Tip: ALWAYS put a password on the certificate which is inside the store, I exported it with internet options on windows and set a password. This goes for the keystore ONLY not the truststore.

Afterwards it looks like this:
<sec:keyManagers keyPassword="passwordForCertificate" >
   <sec:keyStore type="PKCS12" password="passwordForStore"
                  file="cert/key.pfx"/>
</sec:keyManagers>

cxf how to get the counduit name right

First I must say the best technique is to first get everything working with the wildcard name:
 <http-conf:conduit name="*.http-conduit">

After that to get the conduit name ok I had to do some digging. The suggestion came from this comment.

He suggested to debug org.apache.cxf.configuration.spring.ConfigurerImpl although where I actually found what I wanted was in:
org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector

There I added a breakpoint and got the default conduit selector (the instance var is called conduitSelector). When you'll be able to get a hold of it check its inherited fields (yes I use netbeans)->selectedConduit->endpointInfo->Inherited->name (type QName) there you have the namespace and the localPart (portname). This debug works only if you are trying to send a message, context starting is not enough.

For those who just want to try without the debugging I used the target namespace of my wsdl and for the portname, just try the port name on the wsdl and append "Port". (it is not the service name! it's the port name!)