Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Luca kk
Problem using MailEngine
October 19, 2012 4:40 AM
Answer

Luca kk

Rank: Expert

Posts: 284

Join Date: December 7, 2010

Recent Posts

Hi all,
I developed my custom portlet (using Liferay 6.1) "LiferayMailFormPortlet" to send emails.
I use NetBeans and in my project I use the following library:
util-java-6.1.0.jar in "lib/ext" folder.
The project is deployed without errors but when I use the portlet
to send an email I get:

LiferayMailFormPortlet is temporarily unavailable.


In log file I get:


ERROR [render_portlet_jsp:154] java.lang.LinkageError: 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 ray.mail.service.MailServiceUtil.getSession()Ljavax/mail/Session; used in the signature
at com.liferay.util.mail.MailEngine.getSession(MailEngine.java:90)
at com.liferay.util.mail.MailEngine.getSession(MailEngine.java:69)
at com.liferay.util.mail.MailEngine.send(MailEngine.java:216)
at com.liferay.util.mail.MailEngine.send(MailEngine.java:163)
at com.liferay.util.mail.MailEngine.send(MailEngine.java:350)
at com.liferay.util.mail.MailEngine.send(MailEngine.java:128)
at com.liferay.util.mail.MailEngine.send(MailEngine.java:403)
at com.primesail.portlets.web.LiferayMailFormPortlet.doView(LiferayMailFormPortlet.java:68)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)


where at "LiferayMailFormPortlet.java:68" line I call the MailEngine.send(from,to,object,message).

I put in my portal-ext-properties the email configuration:

##
## MAIL
##
mail.session.mail.pop3.host=MY-POP
mail.session.mail.imap.host=MY-IMAP
mail.session.mail.imap.port=25
mail.session.mail.store.protocol=imap
mail.session.mail.transport.protocol=smtp
mail.session.mail.smtp.host=MY-SMTP-HOST
mail.session.mail.smtp.password=MY-PASSWORD
mail.session.mail.smtp.user=MY-SMTP-USER
mail.session.mail.smtp.port=25
mail.session.mail.smtp.auth=true
mail.session.mail.smtp.starttls.enable=true


and this works fine.

What's the problem?
Where am I wrong?
Can anybody help me please?

Thanks in advance
Siby Mathew
RE: Problem using MailEngine
October 19, 2012 7:13 AM
Answer

Siby Mathew

Rank: Expert

Posts: 267

Join Date: March 4, 2011

Recent Posts

Hi Luca,
The util-java.jar is already present in ROOT/WEB-INF/lib folder. Your project needs to refer that.

Thanks,
Siby
Jitendra Rajput
RE: Problem using MailEngine
October 25, 2012 2:04 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 873

Join Date: January 7, 2011

Recent Posts

1portal-dependency-jars=\ util-java.jar



Specify above dependency in liferay-plugin-package.properties file of your portlet.