I managed to configure my CXF-based client properly so that it finds the correct SSL certificate for the server on which I am running a web service:
Add below code to set disableCNCheck
HTTPConduit httpConduit=(HTTPConduit)ClientProxy.getClient(port).getConduit();
TLSClientParameters tlsCP = new TLSClientParameters();
tlsCP.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsCP);
Use this code only in the lower environments, In higher environments, it's not recommended.