Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Workflows are not sending emails due to issue Caused by: java.lang.NoClassDefFoundError: javax/activation/DataHandler

Avatar

Level 3

Hi Team,

We have upgraded from Oracle JDK 1.8.0_192 to Open JDK 11.0.1 on our STAGE Author server where AEM 6.5.5.0 is running on Tomcat 8.5.61 Application Server. While running workflows we are getting java.lang.ClassNotFoundException: javax.activation.DataHandler error as mentioned below.

 

16.02.2022 03:55:06.718 *ERROR* [JobHandler: /var/workflow/instances/server0/2022-02-15_2/dxp-page-instant-activation_2:/content/mastercardcom/us/en/test-header/test-workflow-new11] com.adobe.granite.workflow.core.job.JobHandler Error executing workflow step

com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:201)

        at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:260)

        at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:293)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:229)

        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

        at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.lang.NoClassDefFoundError: javax/activation/DataHandler

        at org.apache.commons.mail.Email.createMimeMessage(Email.java:1901)

        at org.apache.commons.mail.Email.buildMimeMessage(Email.java:1326)

        at org.apache.commons.mail.Email.send(Email.java:1495)

        at com.day.cq.mailer.impl.DefaultMailService.send(DefaultMailService.java:300)

        at com.day.cq.mailer.impl.DefaultMailService.send(DefaultMailService.java:45)

        at com.mastercard.dxp.aem.authoring.workflow.SendEmailProcess.send(SendEmailProcess.java:295)

        at com.mastercard.dxp.aem.authoring.workflow.SendEmailProcess.sendEmail(SendEmailProcess.java:134)

        at com.mastercard.dxp.aem.authoring.workflow.SendEmailToAuthorProcess.execute(SendEmailToAuthorProcess.java:121)

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:195)

        ... 8 common frames omitted

Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler

        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)

        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)

        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

        ... 17 common frames omitted

 

Kindly let us know if you find any hints for this issue.

 

PS: We have already updated below property on sling.properties for JDK 11 causing NoClassDefFoundError on AEM 6.5 by referring: https://helpx.adobe.com/ie/experience-manager/kb/jdk-11-causes-noclassdeffounderror---aem-6-5.html

 

From: org.osgi.framework.bootdelegation=sun.*,com.sun.*

To: org.osgi.framework.bootdelegation=sun.*,com.sun.*,jdk.internal.reflect,jdk.internal.reflect.*

 

Regards,

G Patil

 

9 Replies

Avatar

Community Advisor

Hi @gspatil11 

DataHandler comes from JAF; it's not part of JavaMail. JAF is included in JDK 1.8 and older.  you should try    com.sun.activation:javax.activation:1.2.0.

--------------------

<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>

Avatar

Level 3

Hi @Nitin_laad,

 

We tried putting dependency in core-pom.xml. Here dxp-shell-aem-core is one of our application deployed on AEM Author.

gspatil11_0-1645038130578.png

 

But still having same issue:

 

16.02.2022 03:55:06.718 *ERROR* [JobHandler: /var/workflow/instances/server0/2022-02-15_2/dxp-page-instant-activation_2:/content/mastercardcom/us/en/test-header/test-workflow-new11] com.adobe.granite.workflow.core.job.JobHandler Error executing workflow step

com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:201)

        at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:260)

        at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:293)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:229)

        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

        at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.lang.NoClassDefFoundError: javax/activation/DataHandler

        at org.apache.commons.mail.Email.createMimeMessage(Email.java:1901)

        at org.apache.commons.mail.Email.buildMimeMessage(Email.java:1326)

        at org.apache.commons.mail.Email.send(Email.java:1495)

        at com.day.cq.mailer.impl.DefaultMailService.send(DefaultMailService.java:300)

        at com.day.cq.mailer.impl.DefaultMailService.send(DefaultMailService.java:45)

        at com.mastercard.dxp.aem.authoring.workflow.SendEmailProcess.send(SendEmailProcess.java:295)

        at com.mastercard.dxp.aem.authoring.workflow.SendEmailProcess.sendEmail(SendEmailProcess.java:134)

        at com.mastercard.dxp.aem.authoring.workflow.SendEmailToAuthorProcess.execute(SendEmailToAuthorProcess.java:121)

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:195)

        ... 8 common frames omitted

Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler

        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)

        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)

        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

        ... 17 common frames omitted

 

Do we need to add the dependency in AEM 6.5 war file's pom.xml given below instead of pom.xml file of applications running on AEM?

 

pom.xml file location of AEM 6.5 war file : /apps_01/webapps/tomcat/conf/CMS_Authoring_Stage_Server/webapps/aem-stage/META-INF/maven/org.apache.sling/org.apache.sling.launchpad.base/pom.xml

 

<dependency>

  <groupId>com.sun.activation</groupId>

  <artifactId>javax.activation</artifactId>

  <version>1.2.0</version>

</dependency>

 

We have also observed below property with java version 8 on same pom.xml.

<properties>
<sling.java.version>8</sling.java.version>
</properties>

 

Regards,

G Patil

Avatar

Community Advisor

Can you add dependency info into project specific pom files -  ui:apps/pom and core/pom.xml and see if it works

Example - 

 

 

nitinjl_0-1645039702401.png

 

Avatar

Level 3

Hi @nitinjl,

One more point to add, we have attached screenshot of dependency for javax.activation.DataHandler in AEM system/console/depfinder. Please verify and let us know if org.apache.sling.javax.activation dependency to be added in pom.xml instead of com.sun.activation dependency as suggested earlier.
Below is the screenshot.

Screenshot 2022-02-15 at 2.39.37 PM.png

Avatar

Community Advisor

good catch, try with wrapper first, and see if it works for you

 

<dependency> <artifactId>org.apache.sling.javax.activation</artifactId> <version>0.1.0</version> <groupId>org.apache.sling</groupId> <scope>provided</scope> </dependency>

Not sure if you already checked into below link - 

Using Java Mail / Java Activation with Weblogic (adobe.com)

Avatar

Level 3

Hi @nitinjl,

1. We added below dependency in application-core pom.xml. But we end up getting same issue.
<dependency>
<artifactId>org.apache.sling.javax.activation</artifactId>

<version>0.1.0</version>

<groupId>org.apache.sling</groupId>

<scope>provided</scope>

</dependency>

 

2. Next we have removed org.apache.sling.javax.activation in org.osgi.framework.bootdelegation which was added previously for testing

3. As per recommendation in https://helpx.adobe.com/experience-manager/kb/using-java-mail---java-activation-with-weblogic.html, we added javax.activation; version\=1.1.1 in org.osgi.framework.system.packages.extra over sling.properties. But we end up getting same issue.

 

bash-4.2$ diff sling.properties_17022022 sling.properties

 

< org.osgi.framework.system.packages.extra=org.apache.sling.launchpad.api;version\=1.2.0 ${org.apache.sling.launcher.system.packages}

---

> org.osgi.framework.system.packages.extra=javax.activation; version\=1.1.1,org.apache.sling.launchpad.api;version\=1.2.0 ${org.apache.sling.launcher.system.packages}

 

< org.osgi.framework.bootdelegation=sun.*,com.sun.*,jdk.internal.reflect,jdk.internal.reflect.*,org.apache.sling.javax.activation

---

> org.osgi.framework.bootdelegation=sun.*,com.sun.*,jdk.internal.reflect,jdk.internal.reflect.*

Avatar

Community Advisor

@gspatil11 Option-1: You can use AEM standalone server installation to fix javamail dependency issues, and then move to apache tomcat server. 

Option-2 - If requirement is timebound open a daycare ticket 

 

Avatar

Level 3

Hi @nitinjl,

Option-1: You can use AEM standalone server installation to fix javamail dependency issues, and then move to apache tomcat server. 

We cant use AEM standalone server since we have company standard security restrictions to run AEM Author on top tomcat application server.

Option-2 - If requirement is timebound open a daycare ticket 

We have opened ticket with adobe and checking with them in parallel.

As per suggested link we have made changes by referring https://helpx.adobe.com/experience-manager/kb/using-java-mail---java-activation-with-weblogic.html
1. In our case below configuration already exists
org.osgi.framework.system.packages.extra=org.apache.sling.launchpad.api;version\=1.2.0 ${org.apache.sling.launcher.system.packages}

We updated it with javax.activation; version\=1.1.1 as below
org.osgi.framework.system.packages.extra=javax.activation; version\=1.1.1,org.apache.sling.launchpad.api;version\=1.2.0 ${org.apache.sling.launcher.system.packages}

 

Is it suppose to be org.osgi.framework.system.packages.extra=javax.activation; version\=1.1 only as recommended ?
And after updating this we could see 2 dependencies in /system/console depfinder for javax.activation.dataHandler. Attached screenshot FYR.dep_finder.JPG

 

2. I could see below recommendation and do you think this is necessary to remove these bundles?

In order to use JavaMail and JavaActivation in this case, the bundles for them need to be uninstalled:

  • JavaMail API (javax.mail)
  • Apache Sling javax.activation bundle (org.apache.sling.javax.activation)

 

 

Avatar

Community Advisor

@gspatil11 1. 
org.osgi.framework.system.packages.extra=javax.activation; version\=1.1.1 ==> looks good to me

2. you can try below steps to resolve the issue

            a. create a system bundles (Creating an Extension Bundle for a 3rd party library. (adobe.com) for 

           b. Removing the existing below bundles as recommended

  • JavaMail API (javax.mail)
  • Apache Sling javax.activation bundle (org.apache.sling.javax.activation)

if it works, you should remove javax.activation entries from pom.xml and revalidate. 

 

One more option you can  try is - place the javax.activation jar in tomcat/libs folder.