FolderClosedException: * BYE JavaMail Exception: java.io.IOException: Connection dropped by server?

不问归期 提交于 2020-06-15 22:31:24

问题


I'm using javamail 1.5.5 and I want to listen for new messages in a GMail mailbox.

I have an implementation of MessageCountListener, on its messagesAdded method, at the end I do:

try {
        // process new messages
        idleManager.watch(ifo); // keep watching for new messages
    } catch (MessagingException mex) {
        logger.error(".....", mex);
    }

I'm not sure to understand because I get that exception...

I believe that I'm doing what said here https://javamail.java.net/nonav/docs/api/com/sun/mail/imap/IdleManager.html#watch-javax.mail.Folder-

Follows some mail debug log, consider that after that exception, no new messages arrived anymore to the listner.

DEBUG IMAP: IdleManager selected 1 channels
DEBUG IMAP: IdleManager selected folder: imaps://xxxxxxxxxx@imap.gmail.com:993/INBOX
* 1026 FETCH (UID 4284 FLAGS (\Answered \Seen))
DEBUG IMAP: IdleManager continue watching folder imaps://xxxxxxx@imap.gmail.com:993/INBOX
DEBUG IMAP: IdleManager adding imaps://xxxxxxxxx@imap.gmail.com:993/INBOX to selector
DEBUG IMAP: IdleManager waiting...
DEBUG IMAP: IdleManager selected 1 channels
DEBUG IMAP: IdleManager selected folder: imaps://xxxxxxxxxxx@imap.gmail.com:993/INBOX
DEBUG IMAP: handleIdle: set to RUNNING
DEBUG IMAP: IdleManager got exception for folder: imaps://prismatest@imap.gmail.com:993/INBOX, THROW: 
javax.mail.FolderClosedException: * BYE JavaMail Exception: java.io.IOException: Connection dropped by server?
    at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3199)
    at com.sun.mail.imap.IdleManager.processKeys(IdleManager.java:370)
    at com.sun.mail.imap.IdleManager.select(IdleManager.java:281)
    at com.sun.mail.imap.IdleManager.access$200(IdleManager.java:137)
    at com.sun.mail.imap.IdleManager$1.run(IdleManager.java:164)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
DEBUG IMAP: IdleManager waiting...

Thanks, bye

来源:https://stackoverflow.com/questions/43252891/folderclosedexception-bye-javamail-exception-java-io-ioexception-connection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!