0
votes

I am getting this error when trying to use the SMTP sampler in Apache JMeter 5.3:

avax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 465
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961) ~[mail-1.5.0-b01.jar:1.5.0-b01]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654) ~[mail-1.5.0-b01.jar:1.5.0-b01]
at javax.mail.Service.connect(Service.java:295) ~[mail-1.5.0-b01.jar:1.5.0-b01]
at javax.mail.Service.connect(Service.java:176) ~[mail-1.5.0-b01.jar:1.5.0-b01]
at org.apache.jmeter.protocol.smtp.sampler.protocol.SendMailCommand.execute(SendMailCommand.java:323) ~[ApacheJMeter_mail.jar:5.3]
at org.apache.jmeter.protocol.smtp.sampler.SmtpSampler.executeMessage(SmtpSampler.java:169) [ApacheJMeter_mail.jar:5.3]
at org.apache.jmeter.protocol.smtp.sampler.SmtpSampler.sample(SmtpSampler.java:146) [ApacheJMeter_mail.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:630) [ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.3]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_271]

Caused by: javax.net.ssl.SSLHandshakeException: A potential protocol version downgrade attack
at sun.security.ssl.Alert.createSSLException(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.Alert.createSSLException(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.TransportContext.fatal(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.TransportContext.fatal(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.TransportContext.fatal(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.ServerHello$ServerHelloConsumer.onServerHello(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.ServerHello$ServerHelloConsumer.consume(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.SSLHandshake.consume(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.HandshakeContext.dispatch(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.HandshakeContext.dispatch(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.TransportContext.dispatch(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.SSLTransport.decode(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.SSLSocketImpl.decode(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_271]
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_271]
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:527) ~[mail-1.5.0-b01.jar:1.5.0-b01]
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:332) ~[mail-1.5.0-b01.jar:1.5.0-b01]
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:234) ~[mail-1.5.0-b01.jar:1.5.0-b01]
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1927) ~[mail-1.5.0-b01.jar:1.5.0-b01]
... 11 more
  1. I have updated to the newest version of Java and Apache JMeter.
  2. I tryied setting the property: https.default.protocol=TLSv1.2 in jmeter.properties without any change.

Any suggestions?

2

2 Answers

0
votes

The question doesn't contain full details so I can only assume that there is a mismatch between your email server and JMeter SSL protocols and most likely JMeter is trying to establish the connection using lower protocol version than the server is using.

You can add the next line to system.properties file:

javax.net.debug=all

and it should give you more insights regarding what is the cause of the problem and once you narrow this down it will be easier to find the solution.

One of the workarounds is adding the next line to the aforementioned system.properties file:

jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"

If my assumption is wrong and it's JMeter using too new protocol you can try downgrading your JDK version, the minimum required for JMeter 5.3 is Java 8

More information:

0
votes

I found the solution which wat pretty close to what Dmitri T suggested. I had to add TLSv1.3 to the list and also to enable TLSv1.3 in Java Control Panel.

I tried other setups as well, but this was the only pattern I found working.

Complete JMeter configuration string: jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2,TLSv1.3"