Expand my Community achievements bar.

NoClassDefFoundError for javax.net.ssl.HostnameVerifier in case of third party jars which I am installing as bundle.

Avatar

Level 1

Hi Experts,

 

I am trying to use one 3rd party jar (cloudinary) so that AEM can connect to cloudinary APIs, I have created bundle from these jars and installed in Felix console. Now when I am trying to invoke my logic to connect to cloudinary APIs, it is throwing  "java.lang.ClassNotFoundException: javax.net.ssl.HostnameVerifier not found" by jarBundle (3rd party jar bundle). while debugging I saw that this HostnameVerifier is available at rt.jar for 3rd party jar bundle still this issue is appearing.

 

Could someone help me here ?

 

Here is the exception stacktrace 

 

Caused by: java.lang.NoClassDefFoundError: javax/net/ssl/HostnameVerifier
at org.apache.http.impl.client.HttpClients.custom(HttpClients.java:48)
at com.cloudinary.http44.UploaderStrategy.init(UploaderStrategy.java:40)
at com.cloudinary.Uploader.<init>(Uploader.java:43)
at com.cloudinary.Cloudinary.uploader(Cloudinary.java:43)
at com.abhi.www.cloudinary.impl.workflow.UpdateAssetWorkflowProcess.execute(UpdateAssetWorkflowProcess.java:51)
at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.net.ssl.HostnameVerifier not found by cloudinaryBundle [570]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(Unknown Source)

 

This issue is happening only in AEM environment, if I am trying to connect that cloudinary apis in standalone Java Maven by using maven dependencies rather than plugin bundle creation (which I did in AEM), there is no such issue while invoking the api access logic.

 

Regards,

Vikas

3 Replies

Avatar

Community Advisor

can you share with us more details like whatare you trying to upload like which bundle ..

Avatar

Level 1

I am trying to use cloudmersive(third party) bundle 

<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v2.75</version>
</dependency>

 

I exported the jar to a bundle and installed it in aem using system/console. After upload, my cloudmersive and project bundles, both were in Active state, but was facing the issue which I posted few days back(

NoClassDefFoundError for javax.net.ssl.HostnameVerifier).

 

To solve it, I added javax.net.ssl entry in Import-package of the cloudmersive bundle manifest file and the error got resolved.

 

But, now getting new errors related to other dependencies which are not even exported by aem like - com.squareup.okhttp and other external classes referenced by cloudmersive bundle internally. Not sure how to proceed.