使用SpringIntegration和Imap轮询电子邮件时,我遇到了一个非常奇怪的问题。
一切正常,但有一段时间我有一个错误,如果它无法连接到邮箱,就像它没有收听SSL端口一样。
然后在事情进展顺利之后。 如果在此期间收到电子邮件,这很烦人,因为我的子进程中的邮件会失败。
你知道为什么我突然得到这样的例外:
一切顺利
2016-06-01 13:40:43,570 INFO [org.springframework.integration.mail.ImapMailReceiver] - <attempting to receive mail from folder [INBOX]>
2016-06-01 13:41:06,242 INFO [org.springframework.integration.mail.ImapMailReceiver] - <attempting to receive mail from folder [INBOX]>
2016-06-01 13:41:13,572 INFO [org.springframework.integration.mail.ImapMailReceiver] - <attempting to receive mail from folder [INBOX]>
2016-06-01 13:41:36,238 INFO [org.springframework.integration.mail.ImapMailReceiver] - <attempting to receive mail from folder [INBOX]>
然后
2016-06-01 13:41:43,569 INFO [org.springframework.integration.mail.ImapMailReceiver] - <attempting to receive mail from folder [INBOX]>
2016-06-01 13:42:06,228 ERROR [org.springframework.integration.handler.LoggingHandler] - <org.springframework.messaging.MessagingException: failure occurred while polling for mail; nested exception is javax.mail.MessagingException: Unrecognized SSL message, plaintext connection?;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:117)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:144)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:192)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:55)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:149)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:298)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:292)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
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.run(FutureTask.java:262)
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:745)
Caused by: javax.mail.MessagingException: Unrecognized SSL message, plaintext connection?;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:726)
at javax.mail.Service.connect(Service.java:364)
at javax.mail.Service.connect(Service.java:245)
at javax.mail.Service.connect(Service.java:194)
at org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:227)
at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:238)
at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:260)
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:103)
... 19 more
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:671)
at sun.security.ssl.InputRecord.read(InputRecord.java:504)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:543)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:348)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:236)
at com.sun.mail.iap.Protocol.<init>(Protocol.java:117)
at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:121)
at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:746)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:689)
... 26 more
&GT;
然后又好了
我在此处描述了我使用的配置:SpringIntegration Mail Failed to create new store connection Unrecognised SSL message
我认为这是由于邮件文件夹副本。但即使在阅读/查看电子邮件时也会发生这种情况。
有什么想法吗?
由于
吉勒
答案 0 :(得分:0)
奇怪的是它是间歇性的 - 也许服务器是负载均衡器后面的集群,没有为SSL配置一个实例。将mail.debug
属性设置为true
可能会有所启发。