在ImapMailReceiver中有com.sun.mail.imap.IMAPFolder和com.sun.mail.imap.IMAPMessage的强制转换。当我们的应用程序从spring integration 2.0.1升级到更新的东西时(因为2.0.1中的错误)我们的app现在在运行时因ClassCastException而失败,因为我们没有使用来自com.sun的Message impl,我们正在使用自定义的东西。这个演员会被删除吗?
编辑,这是使用2.2.3运行的堆栈跟踪:
org.springframework.integration.MessagingException: failure occurred while polling for mail
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:73)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:111)
at org.springframework.integration.endpoint.AbstractTransactionSynchronizingPollingEndpoint.doPoll(AbstractTransactionSynchronizingPollingEndpoint.java:67)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:236)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:231)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassCastException: our.custom.IMAPMessage cannot be cast to com.sun.mail.imap.IMAPMessage
at org.springframework.integration.mail.ImapMailReceiver.searchForNewMessages(ImapMailReceiver.java:146)
at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:235)
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:59)
... 19 more
答案 0 :(得分:0)
请参阅提问。
请继续打开Improvement JIRA Issue,然后我们来看看。更好的是,make a contribution。
请记住,它可能会导致问题 - 例如我们必须投射以设置peek
属性......
((IMAPMessage) message).setPeek(true);