formatix
formatix
02-10-2017
In our AEM Forms 6.3 J2EE environment we are using the LiveCycle EmailService succesfully.
Now, for another process, we want to use the Day CQ Mail Service also.
After submitting the adaptive form to the com.day.cq.mailer.DefaultMailService we get an error:
Error during include of component '/libs/fd/af/components/guideContainerWrapper'
Error Message:
java.lang.LinkageError: javax/mail/Session
It seems there is a conflict with the two different EmailSerivces?
smacdonald2008
smacdonald2008
02-10-2017
Email in AEM is typically used for AEM Workflows. Looks like you want to send an email when a form is submitted, If so, develop a custom AEM service that uses Java MAIL API to send emails.
Ratna_Kumar
MVP
Ratna_Kumar
MVP
03-10-2017
Hi,
Yes, Scott is correct. You can see the typical exam of HELPX Article we have.
//Adobe Experience Manager Help | Creating custom Adobe Experience Manager email services
~Ratna.
formatix
formatix
04-10-2017
Thanks for the answers.
This means that in a JEE environment, the built-in OSGI mail services can not be used; instead, separate components have to be developed?
Jan
adamp25373672
adamp25373672
14-08-2018
Hi Scott,
I've written my own mail service as suggested, using the JavaMail API, but I still get the error:
java.lang.LinkageError: Failed to link javax/mail/Session (Module "javax.mail.api:main" from local module loader @33e5ccce (finder: local module finder @5a42bbf4 (roots: C:\Adobe\Adobe_Experience_Manager_Forms\jboss\modules,C:\Adobe\Adobe_Experience_Manager_Forms\jboss\modules\system\layers\base\.overlays\layer-base-jboss-eap-7.0.6.CP,C:\Adobe\Adobe_Experience_Manager_Forms\jboss\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/mail/Session"
I suspect it's because JBoss is supplying its own javax.mail.api modules (once in system/layers/base, once in the layer-base-jboss-eap-7.0.6.CP overlay). What can I do to fix this?
smacdonald2008
smacdonald2008
14-08-2018
This confirms that there is an issue in your environment. The Java MAIL API should successfully work within an OSGi bundle using MessageServiceGaetway. I will post a short video tomorrow of this working in the AEM environment. If you cannot reproduce the video, we will get cust care involved.
adamp25373672
adamp25373672
15-08-2018
Thanks.
The custom mail service works locally and on a non-JBoss deployment; it's only on the JBoss box it fails.
adamp25373672
adamp25373672
15-08-2018
Hi Scott,
Any updates? I've tried changing around my pom.xml dependency settings, but nothing has made any difference.
The error I'm getting now is slightly different (and much less helpful) than before:
java.lang.LinkageError: javax/mail/Session
at com.sun.mail.util.PropUtil.getBooleanSessionProperty(PropUtil.java:106)
at javax.mail.internet.MimeMessage.initStrict(MimeMessage.java:315) [javax.mail:1.5.0.b01]
at javax.mail.internet.MimeMessage.<init>(MimeMessage.java:193) [javax.mail:1.5.0.b01]
The code in question:
// Get system properties
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", smtpHost);
properties.setProperty("mail.smtp.port", smtpPort);
properties.setProperty("mail.smtp.submitter", smtpUser);
properties.setProperty("mail.smtp.auth", "true");
// Get the authenticated Session object.
Session session = Session.getInstance(properties,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
smtpUser,
smtpPassword);
}
});
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
Mayank_Gandhi
Employee
Mayank_Gandhi
Employee
21-08-2018
I would like to test your code on a Jboss instance, can you please share the collateral's and the step to run the code?
-Mayank
adamp25373672
adamp25373672
21-08-2018
You don't need anything special to reproduce this. Just send email from AEM on a JBoss instance.