Solved

Applet to Servlet Https communication

Posted on 2009-07-08
2
627 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping3 challenge 14 70
Ways to assess https/ssl websites 3 87
java.io.BufferedReader   readLine()  //returns the entire file ? 4 60
jar file executable 12 43
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

867 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

24 Experts available now in Live!

Get 1:1 Help Now