Solved

Applet to Servlet Https communication

Posted on 2009-07-08
2
626 Views
Last Modified: 2013-11-24
Hi Experts,

i have problem to make https communication possible from an applet to a servlet.
At "servletConn.connect();", i got this error: "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"

Through http no problem, i used HttpURLConnection and the applet call http://DEV_TEST/pilotproject/servletcontroller, but for Https (which the url is https://DEV_TEST:81/pilotproject/servletcontroller)... oups! The web server is Glassfish 2.1 and the SSL certificate is a Verisign trial cert (14 days).
HttpsURLConnection servletConn = null;

				

servletConn = (HttpsURLConnection) servlet.openConnection();

servletConn.setRequestMethod("POST");

servletConn.setDoInput(true);

servletConn.setDoOutput(true);

servletConn.setUseCaches(false);

servletConn.setDefaultUseCaches(false);

servletConn.setRequestProperty("Content-type", "application/octet-stream");

servletConn.connect();
 

// Envoyer la requête

ObjectOutputStream output = new ObjectOutputStream(servletConn.getOutputStream());

output.writeObject(pack);

output.flush();

output.close();
 

// Attendre et recevoir la réponse

ObjectInputStream input = new ObjectInputStream(servletConn.getInputStream());

pack = (HttpPackage)input.readObject();

input.close();

Open in new window

0
Comment
Question by:pmrenaud
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 375 total points
ID: 24803477
0
 

Author Closing Comment

by:pmrenaud
ID: 31601096
Thanks!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
count11 challenge 6 49
firstChar challenge 13 86
JAVA part two 5 42
Java array passed to SQL where clause 23 43
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now