Link to home
Start Free TrialLog in
Avatar of pmrenaud
pmrenaud

asked on

Applet to Servlet Https communication

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

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pmrenaud
pmrenaud

ASKER

Thanks!