Forums de discussion

MailMessageListener or MessageListener

thumbnail
Jürgen Troschke, modifié il y a 6 années.

MailMessageListener or MessageListener

New Member Publications: 10 Date d'inscription: 30/09/15 Publications récentes
I want to configure a listener. I try MailMessageListener and MessageListener But with both there are problems.

My Liferay Version is liferay6.2_ee_sp20_Patch156 with JBoss.
Where is my mistake?
----------------------------
I tried that:

1.
File portal.properties
value.object.listener.com.liferay.portal.kernel.messaging.MessageListener=de/zitbb/liferay/interception.MessageListener
Classes:
import com.liferay.portal.kernel.messaging.BaseMessageListener;
import com.liferay.portal.kernel.messaging.Message;
public class MailMessageListener extends BaseMessageListener {
@Override
public void doReceive(Message message) throws Exception {
System.out.println("Message:" + message);
}
}
The Portlet can be deployed with ERROR, but the Listener do not work.
ERROR [ServerService Thread Pool -- 500][HotDeployImpl:233] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering hook for zitbb-user-portletzitbb-user-portlet
...
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
2.
File portal.properties
value.object.listener.com.liferay.mail.messaging.MailMessageListener=de/zitbb/liferay/interception.MyMailMessageListener
mport com.liferay.portal.kernel.mail.MailMessage;
import com.liferay.portal.kernel.messaging.Message;
import com.liferay.mail.messaging.MailMessageListener;
public class MyMailMessageListener extends MailMessageListener {
@Override
public void doReceive(Message message) throws Exception {
System.out.println( message);
}
@Override
public void doMailMessage(MailMessage mailMessage) throws Exception {
System.out.println(mailMessage);
}
}
Failed to define class de.zitbb.liferay.interception.MyMailMessageListener in Module "deployment.zitbb-user-portlet.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link de/zitbb/liferay/interception/MyMailMessageListener (Module "deployment.zitbb-user-portlet.war:main" from Service Module Loader)
Caused by: java.lang.NoClassDefFoundError: com/liferay/mail/messaging/MailMessageListener