Hi,
A simple imap email program fails on appengine. The error message is clear
that appengine does not allow socket classes. Can anyone suggest an option
other than running the service outside appengine?
Our app runs completely on GAE and it's painful to go for webservice from
other cloud provider because of this. I wish google provides some secure
wrappers to their own useful services..
java.lang.NoClassDefFoundError: javax.net.SocketFactory is a restricted class.
Please see the Google App Engine developer's guide for more details.
public static void doit() {
Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imaps");
try {
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("imaps");
store.connect("imap.gmail.com", "<username>", "<password");
System.out.println(store);
Folder inbox = store.getFolder("Inbox");
inbox.open(Folder.READ_ONLY);
Message messages[] = inbox.getMessages();
System.out.println("Message count = " + messages.length);
for(int i=0; i<50; i++) {
System.out.println("Time = " + messages[i].getReceivedDate() + "; Subject =
" + messages[i].getSubject());
}
} catch (NoSuchProviderException e) {
e.printStackTrace();
System.exit(1);
} catch (MessagingException e) {
e.printStackTrace();
System.exit(2);
}
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine-java/-/cLUdlzUWQY4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.