JODD Message parsing failed; <--- java.lang.NullPointerException

132 Views Asked by At

I'm using Jodd version 3.9 and I would like to read an outlook account (Microsoft Exchange). ]

    int port = 993;
    ImapSslServer imapServer = new ImapSslServer("mail.myhost.it", port, "authuser", "authpass");
    imapServer.setProperty("mail.imap.connectiontimeout", "15000");

    ReceiveMailSession session = imapServer.createSession();
    session.open();
    _log.info("total number of inbox emails : " + session.getMessageCount());
    ReceivedEmail[] emails = session.receiveEmailAndMarkSeen(EmailFilter.filter().flag(Flags.Flag.SEEN, false));

but i get this error at the line : session.receiveEmailAndMarkSeen(...)

jodd.mail.MailException: Message parsing failed; <--- 
java.lang.NullPointerException

this is a debug:

A8 FETCH 4 (BODYSTRUCTURE)
* 4 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 1401 35 NIL NIL NIL NIL) "mixed" ("boundary" "----=_Part_1029639_1159929762.1507643405808") NIL NIL))

[ERROR] 11 ott 04:57:31.467 PM [com.afterbit.jobs.EmailJob] (mGxTfT0) EXCEPTION session.receiveEmailAndMarkSeen : jodd.mail.MailException: Message parsing failed; <--- java.lang.NullPointerException

A9 CLOSE
A8 OK FETCH completed.
A9 OK CLOSE completed.

I cannot understand why...

1

There are 1 best solutions below

1
afterbit On

[SOLVED] I hope this help... and save time (i have spend many days..) there is a conflict between javamail and apache CXF. apache cxf has a inner file geronimo-javamail_1.4_spec-1.7.1.jar .. so if you add into your project also mail.jar (javamail) and use IMAP protocol, it can generate error like above!