• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in httpsConnection

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using a webservice for authorizing credit card details.
The url for this is suppose:

https://test.otherwebsite.com?userid=11&pwd=535

Now this will generate some response headers and I want to parse them to know whether transaction has been successful.So I wrote code:



I am using jboss server.
Now I get an error:

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

Can anyone tell how can I resolve this error.Also ,when I directly copy and paste this link on browser then I am able to see the headers with no error.

Thanks.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using a webservice for authorizing credit card details.
The url for this is suppose:

https://test.otherwebsite.com?userid=11&pwd=535

Now this will generate some response headers and I want to parse them to know whether transaction has been successful.So I wrote code:


code:
--------------------------------------------------------------------------------

URL url = new URL("https://test.otherwebsite.com?userid=11&pwd=535"); HttpsURLConnection huc = (HttpsURLConnection) url.openConnection(); huc.connect(); InputStream is = huc.getInputStream(); out.println("code:"+huc.getResponseCode()); huc.disconnect();

--------------------------------------------------------------------------------



I am using jboss server.
Now I get an error:

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

Can anyone tell how can I resolve this error.Also ,when I directly copy and paste this link on browser then I am able to see the headers with no error.

Thanks.
Hi,
The problem you face is that the server gives a certificate which you were not able to verify with the CA certs available on your CAcerts keystore.Which is usually in "jre/lib/security/cacerts" import the certificate that was sent by your server to this keystore.
 
Preeti Arora
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much for reply.
I am just using a trial certificate and it is in conf directory of jboss.
Can you tell me more details on how to import?

Thanks again.
 
Thilak Raj Surendra Babu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much for reply.
I am just using a trial certificate and it is in conf directory of jboss.
Can you tell me more details on how to import?

Thanks again.
Hi,
The server sends a server certificate which needs to be verified with the help of cacerts on your machine.Try Importing the certificate of the server using keytool or alternatively go through this site which would be very useful "http://blogs.sun.com/andreas/entry/no_more_unable_to_find"

Thanks
Thilak Raj S
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic