cancel
Showing results for 
Search instead for 
Did you mean: 

Java map with HttpsURLConnection - Cannot cast error

Former Member
0 Kudos

Hi All,

I am trying to open https connection from Java mapping with the below code but at run time got error as

“Cannot cast class com.sap.engine.httpdsrclient.protocols.instrumented.https.DSRHttpsURLConnection to class javax.net.ssl.HttpsURLConnection in the line (HttpsURLConnection)

String httpsURL = "https://example.com/";

URL myurl = new URL(httpsURL);

HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();

con.setRequestMethod("GET");

Referred the thread http://scn.sap.com/thread/1939244 and modified the code, still facing the same error.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Kumar,

The class that you are using has changed in you PI jvm version. You should check your PI jvm version and later go to the API and to check the class HttpsURLConnection.

Check for example this case:

http://stackoverflow.com/questions/23517139/java-lang-classcastexception-com-sun-net-ssl-internal-ww...

I show you that thread that you can see that the class can change depending your PI jvm.

Regards.

Answers (0)