javax.mail.internet.MimeMessage无法强制转换为javax.mail.Message

问题描述 投票:0回答:1

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];
java javamail liferay-7 mime-message message-listener
1个回答
-2
投票

那是因为您正在将MimeMessage转换为Message,尝试更改如下,

MimeMessage mimeMessage = (javax.mail.internet.MimeMessage) array[1];
© www.soinside.com 2019 - 2024. All rights reserved.