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 PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to fin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to fin" Watch "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to fin" New topic
Author

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to fin

rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Hi All,

I am facing trying to consume web service that is being deployed on different host from my web service.

when i enquired the admin team has given me the client certificate to install at my end to be as a trusted callee. But im not sure where i need to install/keep the .crt file.

any help will be greatly appreciated.

thanks


thanks & regards, Rakesh
faisal hameed
Ranch Hand

Joined: Jan 19, 2009
Posts: 48
Please explain a little bit more.
How do you consuming web services?
Does the error is shown during creating stub?


Regards, M Faisal Hameed
PUCIT, Pakistan
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 460
    
    4
If it helps in terms of what:

0. I guess that your service provider end-point is SSL-based secured. HTTPS

1. The error should be javax.net.ssl.SSLHandshakeException

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target

GOOGLE for details on how SSL works.


2. You need to import the public key certificate given to you into a YOURKEYSTORE and use it


NOTE: I still wonder if this is the correct way you use to set up/import pk certificate for Websphere, Glassfish, Oracle
but a stand-alone java application, it works.
rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Thanks Paul & Hameed for quick replies.

Here is what i am trying to achieve:

I have a web service residing in Oralce Websphere server which runs on SSL certificate. I am trying to consume that web service from a client program inside my application by generating stubs using axis2.

when i generate stubs i dont see any errors, but when i try to consume or invoke the web service operation it is showing below exception. I think i need to import the certificate from the service provider into my application which runs on JBoss unix machine. But i want to know where to keep the client certificate given web service provider.
faisal hameed
Ranch Hand

Joined: Jan 19, 2009
Posts: 48
You have to set these two setting before calling web service from your client.


certificate.jks file is created from the certificate.cer file provided by your WebService provider.

If the problem persists then might be you are using the incorrect certificate.

Also try it with enabling debug option and see what is happening on console.

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 460
    
    4
1. For recommendation on the management of certificates, keystore and truststore
you need to check the documentation for your specific version of JBOSS version.
This is for dev and production. This is a must.


2. Now, for DEV only,

a. import the certificate from the service provider into the truststore
and store it in server.truststore for example

<jboss_installation_directory>\server\YYYY\conf\server.truststore
where YYYY is the server configuration like default for example

b. Refer to this <jboss_installation_directory>\server\YYYY\conf\server.truststore
within the code


....
call the service provider

c. OR Refer to this <jboss_installation_directory>\server\YYYY\conf\server.truststore
by adding to JVM arguments

Restart the server/YYYY: run -c YYYY

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to fin