当我尝试发送消息时,我遇到了类强制转换异常。
我觉得不是拿javax.mail.internet
,而是拿jdk一罐。
java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeMultipart cannot be cast to javax.mail.internet.MimeMultipart
MimeMessage mimeMessage = (MimeMessage) content;
ContentType multiContentType = new ContentType(mimeMessage
.getContentType());
final MimeMultipart mimeMultipart = (MimeMultipart) mimeMessage.getContent(); // line I am getting ClassCast exception.
我试图通过这种方式更改代码:
final javax.mail.internet.MimeMultipart mimeMultipart = (javax.mail.internet.MimeMultipart) mimeMessage.getContent();
但是它不起作用。