Failed to import javax.activation in Jdeveloper for MAF

I am trying to deploy an Oracle MAF application on an iOS platform. I use Java Mail to receive emails from the gmail server. I am trying to identify letters that have attachments. However, I get the following error.

java.lang.ClassCastException: com.sun.mail.imap.IMAPInputStream cannot be passed to javax.mail.Multipart

When I define the mime type of a message as "multipart / mixed", I try to pass the object to Multipart.

I understand that this question was asked before, but I tried to implement the proposed solution here . However, I cannot import anything from javax.activation. The error I get in jdeveloper is

Error: javax.activation.CommandMap is not available in the profile.

This error is displayed for everything starting with javax.activation

In addition, this error appears only in the MAF application. It works well in a regular Java project.

How can I deal with this problem?

import java.util.Properties; import javax.mail.Folder; import javax.mail.Message; import javax.mail.Multipart; import javax.mail.Session; import javax.mail.Store; public class Email { public Email() { String userName = " abc@gmail.com "; String password = "password"; String receivingHost; receivingHost="imap.gmail.com"; Properties props=System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); Session session=Session.getDefaultInstance(props, null); try { Store store=session.getStore("imaps"); store.connect(receivingHost,userName, password); Folder folder=store.getFolder("INBOX"); folder.open(Folder.READ_ONLY); Message messages[]=folder.getMessages(); //System.out.println(messages.length); for (Message message : messages) { if(message.isMimeType("multipart/mixed")) { Multipart mp = (Multipart)message.getContent(); //get content } else { //getcontent } } store.close(); } catch (Exception e) { System.out.println(e.toString()); } //System.out.println("Done"); } } 
0
source share

All Articles