Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28647

Fix IMAP connector when using IMAPS protocol

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.10
    • Fix Version/s: 11.1, 2021.0
    • Component/s: IMAP Connector
    • Backlog priority:
      650
    • Team:
      PLATFORM
    • Sprint:
      nxplatform 11.1.30, nxplatform 11.1.31
    • Story Points:
      3

      Description

      Addon required: Nuxeo IMAP Connector

      When configuring an Email Folder for GMail (or Office 365 Outlook) as explained in Nuxeo IMAP Connector - Email Folder Parameters for a Gmail Account, the following error is reported in the logs:

      2020-02-03T15:02:12,013 ERROR [Quartz_Worker-1] [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Exception during mailReceivedListener sync listener execution, continuing to run other listeners
      org.nuxeo.ecm.core.api.NuxeoException: Unable to build/connect javax.mail.Store
      	at org.nuxeo.mail.MailSessionBuilder$AbstractFrom.buildAndConnect(MailSessionBuilder.java:214) ~[nuxeo-mail-10.10-HF20.jar:?]
      	at org.nuxeo.mail.MailSessionBuilder$FromProperties.buildAndConnect(MailSessionBuilder.java:134) ~[nuxeo-mail-10.10-HF20.jar:?]
      	at org.nuxeo.ecm.platform.mail.utils.MailCoreHelper.doCheckMail(MailCoreHelper.java:212) ~[nuxeo-platform-mail-core-10.10-HF20.jar:?]
      	at org.nuxeo.ecm.platform.mail.utils.MailCoreHelper.checkMail(MailCoreHelper.java:125) ~[nuxeo-platform-mail-core-10.10-HF20.jar:?]
      	at org.nuxeo.ecm.platform.mail.listener.MailEventListener.doHandleEvent(MailEventListener.java:91) ~[nuxeo-platform-mail-core-10.10-HF20.jar:?]
      	at org.nuxeo.ecm.platform.mail.listener.MailEventListener.handleEvent(MailEventListener.java:70) ~[nuxeo-platform-mail-core-10.10-HF20.jar:?]
      	at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:242) [nuxeo-core-event-10.10-HF18.jar:?]
      	at org.nuxeo.ecm.core.scheduler.EventJob.execute(EventJob.java:119) [nuxeo-core-event-10.10-HF18.jar:?]
      	at org.nuxeo.ecm.core.scheduler.EventJob.execute(EventJob.java:65) [nuxeo-core-event-10.10-HF18.jar:?]
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.3.0.jar:?]
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.0.jar:?]
      Caused by: javax.mail.MessagingException: Connection timed out (Connection timed out)
      	at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:670) ~[mail-1.4.5.jar:1.4.5]
      	at javax.mail.Service.connect(Service.java:295) ~[mail-1.4.5.jar:1.4.5]
      	at javax.mail.Service.connect(Service.java:176) ~[mail-1.4.5.jar:1.4.5]
      	at javax.mail.Service.connect(Service.java:196) ~[mail-1.4.5.jar:1.4.5]
      	at org.nuxeo.mail.MailSessionBuilder$AbstractFrom.buildAndConnect(MailSessionBuilder.java:211) ~[nuxeo-mail-10.10-HF20.jar:?]
      	... 10 more
      Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
      	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_181]
      	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_181]
      	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_181]
      	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_181]
      	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_181]
      	at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_181]
      	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673) ~[?:1.8.0_181]
      	at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) ~[?:1.8.0_181]
      	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:319) ~[mail-1.4.5.jar:1.4.5]
      	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:207) ~[mail-1.4.5.jar:1.4.5]
      	at com.sun.mail.iap.Protocol.<init>(Protocol.java:113) ~[mail-1.4.5.jar:1.4.5]
      	at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:111) ~[mail-1.4.5.jar:1.4.5]
      	at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:637) ~[mail-1.4.5.jar:1.4.5]
      	at javax.mail.Service.connect(Service.java:295) ~[mail-1.4.5.jar:1.4.5]
      	at javax.mail.Service.connect(Service.java:176) ~[mail-1.4.5.jar:1.4.5]
      	at javax.mail.Service.connect(Service.java:196) ~[mail-1.4.5.jar:1.4.5]
      	at org.nuxeo.mail.MailSessionBuilder$AbstractFrom.buildAndConnect(MailSessionBuilder.java:211) ~[nuxeo-mail-10.10-HF20.jar:?]
      	... 10 more
      

      The following changes in the addon's code fixes the issue:

      diff --git a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/utils/MailCoreHelper.java b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/utils/MailCoreHelper.java
      index 8777b8b..08cac77 100644
      --- a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/utils/MailCoreHelper.java
      +++ b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/utils/MailCoreHelper.java
      @@ -188,9 +188,6 @@ public final class MailCoreHelper {
                           properties.put("mail.imaps.port", port);
                           properties.put("mail.imaps.starttls.enable", starttlsEnable.toString());
                           properties.put("mail.imaps.ssl.protocols", sslProtocols);
      -                    properties.put("mail.imaps.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
      -                    properties.put("mail.imaps.socketFactory.fallback", socketFactoryFallback.toString());
      -                    properties.put("mail.imaps.socketFactory.port", socketFactoryPort);
                           properties.put("mail.imap.partialfetch", "false");
                           properties.put("mail.imaps.partialfetch", "false");
                       } else if (POP3S.equals(protocolType)) {
      

      It is documented that these socketFactory settings are no longer needed (see e.g. https://javaee.github.io/javamail/FAQ#commonmistakes).

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h