Help with unnamed module

574 views
Skip to first unread message

Gabriel Vila

unread,
Aug 18, 2022, 9:47:56 AM8/18/22
to iDempiere
Hi Community,
I'm working with idempiere 9.

I am trying to read attachments from mails.

This is the exception:
 java.lang.ClassCastException: class com.sun.mail.imap.IMAPInputStream cannot be cast to class javax.mail.Multipart (com.sun.mail.imap.IMAPInputStream and javax.mail.Multipart are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @7e9fb617

Here is the code and the line that triggers the error:

Message[] messages = emailFolder.getMessages();
for (int i = 0; i < messages.length; i++) {
        Message message = messages[i];
         String contentType = message.getContentType();
         if (contentType.contains("multipart")) {                    
                  Multipart multiPart = (Multipart) message.getContent();
                  int numberOfParts = multiPart.getCount();
.....

I've searched the web but can't figure it out.
I appreciate your help
Thanks very much !!!


Gabriel Vila

unread,
Aug 18, 2022, 11:27:43 AM8/18/22
to iDempiere
I solved it
In my plugin project:
1. Delete the added imported packages: javax.mail.* and com.sun.mail.imap
2. Add externals jar: javax.mail-1.6.2.jar and activation-1.1.jar

And works !!
Reply all
Reply to author
Forward
0 new messages