Foren

loader constraint violation using liferay mail

Martina Biermann, geändert vor 12 Jahren.

loader constraint violation using liferay mail

New Member Beiträge: 2 Beitrittsdatum: 27.03.12 Neueste Beiträge
Hello,
i'm using liferay portal 6.1 with tomcat 7.0.23
I set the mail settings in the control panel.

When I try to send n email via liferay mail, i'm getting the following exception:

[ResponseWriterBridgeImpl:241] writing value=[loader constraint violation: when resolving method "com.liferay.mail.service.MailServiceUtil.getSession()Ljavax/mail/Session;"
the class loader (instance of org/apache/catalina/loader/WebappClassLoader)
of the current class, com/liferay/util/mail/MailEngine,
and the class loader (instance of org/apache/catalina/loader/StandardClassLoader)
for resolved class, com/liferay/mail/service/MailServiceUtil,
have different Class objects for the type javax/mail/Session used in the signature]

Is this a configuration problem? Have I to configure which mailing classes to use?
thumbnail
David H Nebinger, geändert vor 12 Jahren.

RE: loader constraint violation using liferay mail

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
You can't use Liferay's session that way because you're in a different war and trying to cross the class loader boundary.

You can either create your own session or use the Liferay facilities to send an email.
thumbnail
Hitoshi Ozawa, geändert vor 12 Jahren.

RE: loader constraint violation using liferay mail

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Are you trying to use the Mail Portlet?
If so, you don't have to setup mail configuration in the Control Panel. These setting are when using Liferay Mail API to send mail out and is not used by the Mail Portlet.

Following page contains information on using the Mail Portlet:

http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/ma-4
Martina Biermann, geändert vor 12 Jahren.

RE: loader constraint violation using liferay mail

New Member Beiträge: 2 Beitrittsdatum: 27.03.12 Neueste Beiträge
I'm using the liferay mail API and get the exception when I call MailEngine.send(from, to, subject, body) method
thumbnail
Hitoshi Ozawa, geändert vor 12 Jahren.

RE: loader constraint violation using liferay mail

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
I'm just used MailServiceUtil.sendEmail(mailMessage); and haven't encountered any problem creating a simple batch mailer portlet.
thumbnail
Fernando Fernandez, geändert vor 9 Jahren.

RE: loader constraint violation using liferay mail

Expert Beiträge: 396 Beitrittsdatum: 22.08.07 Neueste Beiträge
It's probably to late to answer this, but maybe it can help someone else.

I just had the same problem and found out that I was deploying another version of javax.mail in a jar within my portlet's lib.

The problem was solved by removing this jar and using the javax.mail that is already bundled with the liferay+tomcat bundle.

HTH

Fernando