Expand my Community achievements bar.

SOLVED

NoClassDefFoundError on Externalizer class in AEM 6.2

Avatar

Level 2

Hey guys.

I have a new issue today for which I really need your help.

We have a website developed using AEM 6.1 API and deployed in 6.1. Our website has some Java backend. One piece of our java code used the Externalizer class from AEM (com.day.cq.commons). Nothing rocket science so far.

Then we had to deploy everything on AEM 6.2. Now on 6.2 that piece of code is not working anymore. AEM returns this exception out of the blue:

… Caused by: java.lang.NoClassDefFoundError: com/day/cq/commons/Externalizer …
(cannot post full stacktrace as we have confidential stuff)

So the question is, why may that happen ?

My first thought was that maybe something may have changed to the class loader on 6.2. So I dunno if I am on a totally wrong path, but I have compared the Dynamic Class Loader on both AEM versions. Again, maybe I looking in the wrong place, but I definitely think that error has something to do with class loading policies. So, what I saw is that on 6.1 the Dynamic Class Loader is implemented in org.apache.sling.commons.classloader-1.3.2.jar and in 6.2 is implemented in org.apache.sling.commons.fsclassloader-1.0.2.jar.
So looking at the jar versions it looks like in the higher AEM version we have the lower Dynamic Class Loader jar version. When in my mind things should be the other way around. Should that be right? Any ideas?

Tks in advance for you help !

Cheers.

Update 1: I come back with an update because it seams I made a mistake about the two jar versions. My eyes played tricks to me. I was looking on two different jar files (.classloader vs .fsclassloader), two different things. So jar version seams to not be the cause. But still the initial problem stays and I don't know why is happening. So please just ignore second part of my article.

 

Update 2: We are using Java 1.8 everywhere. We have also installed all the hot fixes packages.

 

Update 3: I have also compared our application bundle in each AEM Web Console. Interesting is that on 6.2 our bundle does not import anymore the com.day.cq.commons package, where the Externalizer class resides.

On AEM 6.1 (http://localhost:4502/system/console/bundles/471) :
Imported Packages    
    com.adobe.cq.sightly,version=2.3.0 from com.adobe.cq.sightly.cq-wcm-sightly-extension (435)
    com.adobe.granite.workflow,version=1.0.0 from com.adobe.granite.workflow.api (194)
    com.adobe.granite.workflow.exec,version=1.0.0 from com.adobe.granite.workflow.api (194)
    com.adobe.granite.workflow.metadata,version=1.0.0 from com.adobe.granite.workflow.api (194)
    com.day.cq.commons,version=5.7.0 from com.day.cq.cq-commons (292)
    com.day.cq.dam.api,version=1.7.0 from com.day.cq.dam.cq-dam-api (332)
    com.day.cq.mailer,version=5.9.0 from com.day.cq.cq-mailer (296)
    com.day.cq.wcm.api,version=1.9.0 from com.day.cq.wcm.cq-wcm-api (419)
    ….

On AEM 6.2 (http://localhost:4503/system/console/bundles/444) :
Imported Packages    
    com.adobe.cq.sightly,version=2.5.0 from com.adobe.cq.sightly.cq-wcm-sightly-extension (272)
    com.adobe.granite.license,version=1.1.1 from com.adobe.granite.license (63)
    com.adobe.granite.workflow,version=1.0.0 from com.adobe.granite.workflow.api (214)
    com.adobe.granite.workflow.exec,version=1.1.0 from com.adobe.granite.workflow.api (214)
    com.adobe.granite.workflow.metadata,version=1.0.0 from com.adobe.granite.workflow.api (214)

    ????????????????
    com.day.cq.dam.api,version=1.16.0 from com.day.cq.dam.cq-dam-api (377)
    com.day.cq.i18n,version=5.4.0 from com.day.cq.cq-i18n (182)
    com.day.cq.mailer,version=5.9.0 from com.day.cq.cq-mailer (355)
    com.day.cq.wcm.api,version=1.17.0 from com.day.cq.wcm.cq-wcm-api (258)

Our maven script is configured with <Import-Package>*;resolution:=optional</Import-Package>, but I don't think this is the problem.
 

Update 4: Our piece of code get a reference to Externalizer like this (I dunno if this makes any difference):

    Externalizer externalizer = resourceResolver.adaptTo(Externalizer.class);

1 Accepted Solution

Avatar

Correct answer by
Employee

Can you rebuild the package/bundle with 6.2 uber.jar?

View solution in original post

6 Replies

Avatar

Level 10

I am checking with internal Adobe ppl to see if this is a known issue. 

Avatar

Level 4

smacdonald2008 wrote...

I am checking with internal Adobe ppl to see if this is a known issue. 

 

Any finding on this.I got a similar issue after migrating from AEM6.1 to AEM 6.2.

Please share your finding.

Thanks

Nanda

Avatar

Level 4

Hello there,

Could you share me your thought?

I am facing similar issue after AEM 6.2 migration.

I have migrated from AEM 6.1 to 6.2

Your help would be much appreciated

Thanks

Nanda

Avatar

Correct answer by
Employee

Can you rebuild the package/bundle with 6.2 uber.jar?

Avatar

Level 4

Yes Feike, It is working now.

Thank you ..