Expand my Community achievements bar.

SOLVED

Facing issues connecting to a third party secured url

Avatar

Level 4

Hi,

 

I am trying to connect to a secured url. I have added all the required certificates to the java trust store and keystore. I am using javax.net.ssl.HttpsURLConnection to connect to the url. I am successfully able to do so on my local machine. However on other serverw like staging, prod etc, I am facing issues because weblogic is managing those servers. So, I get a class cast exception - 

weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection.

 

One solution would be to make changes to weblogic env settings and add JAVA_OPTIONS="-DUseSunHttpHandler=true” to the startManagedWebLogic.sh file.I do not want to make changes to any env settings.

Second option is to change my code and use - 

  java.net.URL url;
        javax.net.ssl.HttpsURLConnection httpsConn = null;
        try {
            url = new URL(null, ENDPOINT,new sun.net.www.protocol.https.Handler());'

        }

 

When I try to so, my bundle is not able to resolve this pcakage and giving error - sun.net.www.protocol.https -- Cannot be resolved 

in felix console - system/console/bundles.

 

Any solution would be appreciated to resolve this issues in bundle.

 

Regards,

Shallu Rohilla

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

go to http://localhost:4502/system/console/packages; here you can enter any Java package name and it will print the maven coordinates of the bundle, which contains this package.

kind regards,
Jörg

View solution in original post

7 Replies

Avatar

Level 10

Hi Shallu Rohilla,

 You will have to add the bundle which has the sun.net.www.protocol.https service for AEM felix to resolve it or you can include that jar in your bundle and then deploy it so that it can resolve the same.

Avatar

Level 4

Hi,

This is a sun jar - jsse.jar and I am not able to find a way to include this in my bundle via pom entry since I am unable to find the groupId and artifact id for this jar.

Regards,

Shallu Rohilla

Avatar

Correct answer by
Employee Advisor

Hi,

go to http://localhost:4502/system/console/packages; here you can enter any Java package name and it will print the maven coordinates of the bundle, which contains this package.

kind regards,
Jörg

Avatar

Level 4

Hi,

 

I tried this earlier but it gives no information:

               
PackageVersionExported byMaven Dependency
sun.net.www.protocol.https-No exporting bundle(s) foundNo maven information available

Regards,

Shallu

Avatar

Former Community Member

Shallu Rohilla wrote...

Hi,

 

I tried this earlier but it gives no information:

               
PackageVersionExported byMaven Dependency
sun.net.www.protocol.https-No exporting bundle(s) foundNo maven information available

Regards,

Shallu

 

Hi Shallu,

Can't you host the jar within the local repository. Download a copy of the jar and add it to local repository if there is one. Also, not too sure but all the sun related entries go under sling.properties file. You can find some examples of how soap services are integrated with AEM.

Avatar

Employee Advisor

Hi,

Why don't you use the Apache HTTPClient or the client builtin into AEM? Then you don't need to deal directly with these implementations, but rely on the offical APIs.

kind regards,
Jörg

Avatar

Level 10

Hi Shallu,

If its a SOAP services, then you will have to create the stubs within your bundle and package it along with it.