#1 2019-06-19 05:49:17

auchentoshan
Member
Registered: 2019-05-29

Could not convert socket to TLS for smtp.office365.com

Hi,

While trying to setup office365 SMTP to send mail with the schedule, below error occur.

Tried sending with Gmail SMTP it wroks fine.

I have tried different combination of setting in mail.cf for office365, it just did not work.

Any advice?

--ERROR MESSAGE

java.lang.RuntimeException: javax.mail.MessagingException: Could not convert socket to TLS;
  nested exception is:
    java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
    at net.datenwerke.rs.scheduler.service.scheduler.mail.MailReportAction$1.handleException(MailReportAction.java:149)
    at net.datenwerke.rs.core.service.mail.MailServiceImpl.sendMailSync(MailServiceImpl.java:247)
    at net.datenwerke.rs.scheduler.service.scheduler.mail.MailReportAction.doExecute(MailReportAction.java:140)
    at net.datenwerke.scheduler.service.scheduler.entities.AbstractAction.execute(AbstractAction.java:59)
    at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.executeAction(SchedulerTask.java:614)
    at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.executeActions(SchedulerTask.java:502)
    at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.safeCall(SchedulerTask.java:211)
    at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.call(SchedulerTask.java:103)
    at net.datenwerke.scheduler.service.scheduler.tasks.SchedulerTask.call(SchedulerTask.java:1)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.mail.MessagingException: Could not convert socket to TLS;
  nested exception is:
    java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
    at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1918)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:652)
    at javax.mail.Service.connect(Service.java:317)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:194)
    at javax.mail.Transport.send(Transport.java:124)
    at net.datenwerke.rs.core.service.mail.MailServiceImpl.sendMailSync(MailServiceImpl.java:237)
    ... 11 more
Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
    at java.base/javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:263)
    at java.base/javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:285)
    at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:484)
    at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1913)
    ... 18 more
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
    at java.base/java.security.Provider$Service.newInstance(Provider.java:1831)
    at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
    at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
    at java.base/javax.net.ssl.SSLContext.getInstance(SSLContext.java:168)
    at java.base/javax.net.ssl.SSLContext.getDefault(SSLContext.java:99)
    at java.base/javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:123)
    at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:479)
    ... 19 more
Caused by: java.lang.NullPointerException: No password supplied for PKCS#12 KeyStore.
    at org.bouncycastle.jce.provider.JDKPKCS12KeyStore.engineLoad(Unknown Source)
    at java.base/java.security.KeyStore.load(KeyStore.java:1479)
    at java.base/sun.security.ssl.TrustStoreManager$TrustAnchorManager.loadKeyStore(TrustStoreManager.java:365)
    at java.base/sun.security.ssl.TrustStoreManager$TrustAnchorManager.getTrustedCerts(TrustStoreManager.java:313)
    at java.base/sun.security.ssl.TrustStoreManager.getTrustedCerts(TrustStoreManager.java:55)
    at java.base/sun.security.ssl.TrustManagerFactoryImpl.engineInit(TrustManagerFactoryImpl.java:49)
    at java.base/javax.net.ssl.TrustManagerFactory.init(TrustManagerFactory.java:278)
    at java.base/sun.security.ssl.SSLContextImpl$DefaultManagersHolder.getTrustManagers(SSLContextImpl.java:1052)
    at java.base/sun.security.ssl.SSLContextImpl$DefaultManagersHolder.<clinit>(SSLContextImpl.java:1022)
    at java.base/sun.security.ssl.SSLContextImpl$DefaultSSLContext.<init>(SSLContextImpl.java:1197)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at java.base/java.security.Provider.newInstanceUtil(Provider.java:153)
    at java.base/java.security.Provider$Service.newInstance(Provider.java:1824)
    ... 25 more

--CONFIG FILE

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <smtp>
      <host>smtp.office365.com</host>
      <port>587</port>
      <username>report.scheduler@************.com</username>
      <password>********</password>
     
      <ssl>false</ssl>
     
     <tls>
         <enable>true</enable>
         <require>false</require>
      </tls>
   </smtp>
   <mail>
      <sender>report.scheduler@************.com</sender>
      <forceSender>false</forceSender>
      <encryptionPolicy>allow_mixed</encryptionPolicy>
   </mail>
</configuration>

Last edited by auchentoshan (2019-06-19 05:51:57)

Offline

#2 2019-06-20 16:38:19

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Could not convert socket to TLS for smtp.office365.com

Hi auchentoshan,

in my case this is working, and my configuration file is almost identical to yours:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<smtp>
<host>smtp.office365.com</host>
<port>587</port>
<username>**********.de</username>
<password>**********</password>

<ssl>false</ssl>
<tls>
<enable>true</enable>
<require>false</require>
</tls>
</smtp>
<mail>
<sender>************.de</sender>
<forceSender>false</forceSender>
<encryptionPolicy>allow_mixed</encryptionPolicy>
</mail>
</configuration>

What is your exact reportserver version (rsversion.properties) and your exact java version?

Regards,
Eduardo

Offline

#3 2019-06-27 05:18:06

auchentoshan
Member
Registered: 2019-05-29

Re: Could not convert socket to TLS for smtp.office365.com

My test environment below,

[Test Environment 1]
Win7 Pro 64

#Mon May 06 13:38:08 CEST 2019
version=RS3.0.7-6008
schemaversion=RS3.0-12
buildDate=1557142688407-2019-05-06-13-37-55

C:\Users\****>java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)



[Test Environment 2]
Win10 Pro 64

#Mon May 06 13:38:08 CEST 2019
version=RS3.0.7-6008
schemaversion=RS3.0-12
buildDate=1557142688407-2019-05-06-13-37-55

C:\Users\****>java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

Last edited by auchentoshan (2019-06-27 13:43:51)

Offline

#4 2019-07-02 09:09:05

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Could not convert socket to TLS for smtp.office365.com

Hi auchentoshan,

and is this working in one of your test environments? It seems to be a > java 9 problem. A similar problem is found here: https://github.com/jruby/jruby/issues/4799

Please try with java 8 (from oracle) and let me know if this helps.

Regards,
Eduardo

Offline

#5 2019-07-03 04:39:16

auchentoshan
Member
Registered: 2019-05-29

Re: Could not convert socket to TLS for smtp.office365.com

Hi Eduardo,

It does not work in both environment, could it be because i had older version installed before and causing this problem?

Regards,
Auchentoshan

eduardo wrote:

Hi auchentoshan,

and is this working in one of your test environments? It seems to be a > java 9 problem. A similar problem is found here: https://github.com/jruby/jruby/issues/4799

Please try with java 8 (from oracle) and let me know if this helps.

Regards,
Eduardo

Offline

#6 2019-07-05 08:53:48

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Could not convert socket to TLS for smtp.office365.com

Hi auchentoshan,

could you try with a clean reportserver installation ? Maybe use the bitnami packages, since these are easy to install for testing.
If this doesn't happen in a clean reportserver installation it may give us a hint if it has to do with your upgrade.

Regards,
Eduardo

Offline

#7 2019-07-25 14:55:00

neodrg
Member
Registered: 2019-07-25

Re: Could not convert socket to TLS for smtp.office365.com

Hi,

Same error with a bitnami instance.
On port connection 587.

RS 3.0.7-6008
Openjdk 11.0.3

Regards,

Offline

#8 2019-07-29 09:05:53

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Could not convert socket to TLS for smtp.office365.com

Hi neodrg,

please post the complete stack error on your case and your email configuration file. Further, check here: https://forum.reportserver.net/viewtopi … 6079#p6079
Maybe you have a similar problem?

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB