Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-2817

ImapIdleChannelAdapter javax.mail.FolderClosedException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.2 RC1
    • Fix Version/s: 2.2 RC3
    • Component/s: Mail Support
    • Labels:
      None
    • Environment:
      Windows 7, JDK 7

      Description

      I'm trying to use the mail-attachments sample with the following imap-idle-channel-adapter:

      <int-mail:imap-idle-channel-adapter id="customAdapter"
      store-uri="imaps://user:pw@imap.gmail.com:993/inbox"
      channel="inboundChannel"
      auto-startup="true"
      should-delete-messages="false"
      should-mark-messages-as-read="false"
      java-mail-properties="javaMailProperties"/>

      But I always receive the following error:

      Exception in thread "pool-1-thread-1" org.springframework.integration.transformer.MessageTransformationException: org.springframework.integration.MessageHandlingException: java.lang.IllegalStateException: Error while retrieving the email contents.
      at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:73)
      at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134)
      at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
      at org.springframework.integration.handler.MessageHandlerChain.handleMessageInternal(MessageHandlerChain.java:137)
      at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
      at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
      at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
      at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
      at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
      at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
      at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
      at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
      at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:92)
      at org.springframework.integration.mail.ImapIdleChannelAdapter.access$2200(ImapIdleChannelAdapter.java:56)
      at org.springframework.integration.mail.ImapIdleChannelAdapter$1.run(ImapIdleChannelAdapter.java:224)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: org.springframework.integration.MessageHandlingException: java.lang.IllegalStateException: Error while retrieving the email contents.
      at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:76)
      at org.springframework.integration.transformer.AbstractMessageProcessingTransformer.transform(AbstractMessageProcessingTransformer.java:56)
      at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:67)
      ... 17 more
      Caused by: java.lang.IllegalStateException: Error while retrieving the email contents.
      at org.springframework.integration.samples.mailattachments.support.EmailParserUtils.handleMultipart(EmailParserUtils.java:195)
      at org.springframework.integration.samples.mailattachments.support.EmailParserUtils.handleMultipart(EmailParserUtils.java:251)
      at org.springframework.integration.samples.mailattachments.support.EmailParserUtils.handleMessage(EmailParserUtils.java:99)
      at org.springframework.integration.samples.mailattachments.support.EmailTransformer.transformit(EmailTransformer.java:41)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:69)
      at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:84)
      at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:57)
      at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102)
      at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:102)
      at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:126)
      at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:227)
      at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:127)
      at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:73)
      ... 19 more
      Caused by: javax.mail.FolderClosedException
      at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:639)
      at org.springframework.integration.samples.mailattachments.support.EmailParserUtils.handleMultipart(EmailParserUtils.java:189)
      ... 35 more

      If I set a breakpoint in EmailParserUtils on line 189 and wait a few seconds after an email arrives, everything works fine!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                oleg.zhurakousky@springsource.com Oleg Zhurakousky
                Reporter:
                andyflury Andy Flury
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: