1
0
-1

I am creating a plugin that use to send email using action button in datalist.

When working on the plugin, I got error from this library 

import org.apache.commons.mail.HtmlEmail;

The error that I get is
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/mail/HtmlEmail
3082
    at com.ciptax.custom.DatalistEmailTool.executeAction(DatalistEmailTool.java:134)
3083
    at org.joget.apps.datalist.model.DataList.getActionResult(DataList.java:586)
3084
    at org.joget.plugin.enterprise.CrudMenu.viewList_aroundBody28(CrudMenu.java:161)
3085
    at org.joget.plugin.enterprise.CrudMenu.viewList_aroundBody29$advice(CrudMenu.java:99)
3086
    at org.joget.plugin.enterprise.CrudMenu.viewList(CrudMenu.java:1)
3087
    at org.joget.plugin.enterprise.CrudMenu.handleList_aroundBody26(CrudMenu.java:146)
3088
    at org.joget.plugin.enterprise.CrudMenu.handleList_aroundBody27$advice(CrudMenu.java:99)
3089
    at org.joget.plugin.enterprise.CrudMenu.handleList(CrudMenu.java:1) 

So, I tried to include the library by adding below dependency to pom.xml

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.5</version>
<scope>provided</scope>
</dependency>

The result that I got is still Caused by: java.lang.NoClassDefFoundError:  when run the plugin.

After that, I tried to update the dependancy to 

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.5</version>
<scope>compile</scope>
</dependency>

The result I got is still an error when run the plugin. The error becomes java.lang.LinkageError: which seems like the library have confilct in version.

Caused by: java.lang.LinkageError: loader constraint violation: loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @6e40fa64 wants to load class org.apache.commons.mail.HtmlEmail. A different class with the same name was previously loaded by org.apache.catalina.loader.ParallelWebappClassLoader @69ca04e2. (org.apache.commons.mail.HtmlEmail is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @69ca04e2, parent loader java.net.URLClassLoader @750fe12e)
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2344)


Any idea how to solve this problem?

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi,

      If your identification is correct about conflicting library, you can try to exclude it from the wflow-core dependency

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi, you can try the solutions provided in a similar question plugin with custom email sending.

          CommentAdd your comment...