org.springframework.integration.transformer.MessageTransformationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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!
    via by Andy Flury,
  • 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!
    via by Andy Flury,
    • 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
    No Bugmate found.