Solved

https connection from url object using JSSE

Posted on 2000-05-11
5
296 Views
Last Modified: 2012-08-13
I'm trying to open a url connection using url object by passing https protocol request.  But I'm getting "untrusted Server certificate chain" exception.  I've been to java forum I tried lot many things to get rid of this exception.  But I couldn't make it possible.

Environment is as follows:
Application Server is : WebLogic Application Server
normal java client.
Using JSSE on client side inorder to call https protocol from url.
I'm trying use url.openConnection from a java client to weblogic application server.
Any suggestions appriciated.
0
Comment
Question by:rs_akella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Expert Comment

by:btilley
ID: 2802691
Do you have SSL configured to run on your weblogic server?
0
 
LVL 12

Expert Comment

by:geotiger
ID: 2802885
listening ...
0
 
LVL 1

Expert Comment

by:yanchou
ID: 2803276
What certification did you install in server? Is it self signed certification or from root CA?
0
 

Accepted Solution

by:
kirtish_java earned 100 total points
ID: 2803316
As u r connecting from client to server , u need to configure several things in particular order .
 
           First of all u have to check the sign certificate u have got for ur client application, whether it is included in ur server side list or not.
           Socondly , u should mention from where u have got the sign certificate , means u have signed it ur self or thru CA.B'coz several times ur own signed application gives this exception as it may not be listed in the server side list.
           so , the only thing u have to check is the validation of ur certi and on server side its configuration.
             if still u find some problem during configuration ,  u can easily find me at
    kirtish_parekh@hotmail.com.  
0
 

Author Comment

by:rs_akella
ID: 2805807
I'm getting this exception on client side. Not on server side. I'm getting this initially when client sends first packet of data to server.

This is the scenario.
First server gets the request from client, server sends a certificate to client.  Client checks whether the certificate from server is a trusted one. That's when I'm getting this exception on client side.

Here is the sample code snippet
import java.net.*;
import java.io.*;

/*
 * This example illustrates using a URL to access resources
 * on a secure site.
 *
 * To use Sun's reference implementation of HTTPS protocol, Please set
 * the following Java system property:
 *
 *    java.protocol.handler.pkgs = com.sun.net.ssl.internal.www.protocol
 *
 * If you are running inside a firewall, please also set the following
 * Java system properties to the appropriate value:
 *
 *   https.proxyHost = <secure proxy server hostname>
 *   https.proxyPort = <secure proxy server port>
 *
 */

public class URLReader
{
    public static void main(String[] args)
    {
        try
        {
            URL verisign = new URL("https://192.168.0.15:7002/");
            BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        verisign.openStream()));

            String inputLine;

            while((inputLine = in.readLine()) != null)
                System.out.println(inputLine);
            in.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }    
    }
}

And Here is the StackTrace ---------
E:\jsse1.0.1\samples\urls>java -cp .;E:\jsse1.0.1\lib\jsse.jar;E:\jsse1.0.1\lib\
jcert.jar;E:\jsse1.0.1\lib\jnet.jar -Dhttps.proxyHost=192.168.0.15 -Dhttps.proxy
Port=8080 -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol URL
Reader
javax.net.ssl.SSLException: untrusted server cert chain
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
        at com.sun.net.ssl.internal.ssl.ClientHandshaker.a([DashoPro-V1.2-120198
])
        at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage([DashoPr
o-V1.2-120198])
        at com.sun.net.ssl.internal.ssl.Handshaker.process_record([DashoPro-V1.2
-120198])
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
        at com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120
198])
        at java.io.OutputStream.write(OutputStream.java:65)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake([DashoPro-V
1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.doConnect([Da
shoPro-V1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.NetworkClient.openServer(
[DashoPro-V1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpClient.l([DashoPro-V1
..2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpClient.<init>([DashoP
ro-V1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.<init>([Dasho
Pro-V1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V
1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V
1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.connec
t([DashoPro-V1.2-120198])
        at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getInp
utStream([DashoPro-V1.2-120198])
        at java.net.URL.openStream(URL.java:818)
        at URLReader.main(URLReader.java, Compiled Code)
StackTrace Ends Here -----------------
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java exception bubble up 2 26
jboss wildfly 10.1 10 600
How do I remove an object from a 3 60
SequenceInputStream example 3 37
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

734 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