javax.mail.Message mimeMessage = (javax.mail.Message)array[1];
抛出
com.liferay.portal.kernel.messaging.MessageListenerException: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.Message.
Caused by: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.Message
public void Receive(Message message) throws Exception {
Object[] array = (Object[])message.getPayload();
FileVersion sourceFileVersion = (FileVersion)array[0];
javax.mail.Message mimeMessage = (javax.mail.Message)array[1];
答案 0 :(得分:-2)
那是因为您正在将MimeMessage投射到Message,请尝试如下更改
MimeMessage mimeMessage = (javax.mail.internet.MimeMessage) array[1];