Foros de discusión

loader constraint violation using liferay mail

Martina Biermann, modificado hace 12 años.

loader constraint violation using liferay mail

New Member Mensajes: 2 Fecha de incorporación: 27/03/12 Mensajes recientes
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, modificado hace 12 años.

RE: loader constraint violation using liferay mail

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
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, modificado hace 12 años.

RE: loader constraint violation using liferay mail

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
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, modificado hace 12 años.

RE: loader constraint violation using liferay mail

New Member Mensajes: 2 Fecha de incorporación: 27/03/12 Mensajes recientes
I'm using the liferay mail API and get the exception when I call MailEngine.send(from, to, subject, body) method
thumbnail
Hitoshi Ozawa, modificado hace 12 años.

RE: loader constraint violation using liferay mail

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
I'm just used MailServiceUtil.sendEmail(mailMessage); and haven't encountered any problem creating a simple batch mailer portlet.
thumbnail
Fernando Fernandez, modificado hace 9 años.

RE: loader constraint violation using liferay mail

Expert Mensajes: 396 Fecha de incorporación: 22/08/07 Mensajes recientes
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