This discussion is archived
2 Replies Latest reply: Mar 15, 2012 3:30 PM by EJP RSS

Error: This operation is not allowed on a closed folder

923147 Newbie
Currently Being Moderated

I am using Javamail to deposit messages in bulk via IMAP.
Looking forward for some Input.. Thanks

I am able to get the Store for IMAP and the IMAP Folder too while accessing it through multiple threads for multiple users . However, while trying to close the IMAPFolder at the end of the call I am getting the below error.

java.lang.IllegalStateException: This operation is not allowed on a closed folder
     at com.sun.mail.imap.IMAPFolder.close(
     at com.sun.mail.imap.IMAPFolder.close(
     at com.agnity.vm.mssAdaptor.provider.MessageProviderImpl.disconnectFromInbox(

Source Code Snippet:

try {
               if (imapFolder != null && imapFolder.isOpen()) {
          } catch (MessagingException msgEx) {
          } finally {
               try {
                    if (imapStore.isConnected()) {

               } catch (MessagingException e) {


  • Correct Answers - 10 points
  • Helpful Answers - 5 points