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?
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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?
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Thanks.
The custom mail service works locally and on a non-JBoss deployment; it's only on the JBoss box it fails.
Views
Replies
Total Likes
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);
Views
Replies
Total Likes
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
Views
Replies
Total Likes
You don't need anything special to reproduce this. Just send email from AEM on a JBoss instance.
Views
Replies
Total Likes
Hi,
I think there is another thread for a similar query, the answer posted By Scott and Kevin is correct(JBoss modules causing LinkageError ).
When AEM is deployed on an Application Server then the Day CQ Mail Service javax.mail bundle needs to be replaced because these Application Server come with their own javax.mail packages, and AEM should use these instead of the ones provided by the bundle.
To do so one needs to create a javax.mail fragment bundle as described in:
http://helpx.adobe.com/experience-manager/kb/CreatingExtension.html
Day CQ Mail Service does not work on AEM Forms JEE
Also, what I could check internally this has been left for developer to take care and would not be done from the product side.
Views
Replies
Total Likes