Received fatal alert: handshake_failure

I am trying to connect to oracle database but I keep facing facing SSL issue despite adding values for trust store and key store in gatling.config file. Am I missing anything from my end in terms of configuration?

Code for Scala for JDBC connection:

`
private val dbConnectionString = “jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=off)(FAILOVER=on)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)(HOST= 1.2.3.4.5)(PORT=#$%$))(ADDRESS=(PROTOCOL=TCPS)(HOST= 1.2.3.4.6)(PORT=12345)))(CONNECT_DATA=(SERVER=DEDICATED) (SERVICE_NAME= abcdef)))”

private val sqlQuery = “SELECT * FROM abc.def)”
private val sqlUserName = “abc”
private val sqlPassword = “xyzzy”
private val message = “${DCN}”

val sqlQueryFeeder: SourceFeederBuilder[Any] = jdbcFeeder(dbConnectionString,
sqlUserName,
sqlPassword,
sqlQuery
)

`

gatling.config code for trust store and keystone

`
http {
ssl {
keyStore {
type = “JKS” # Type of SSLContext’s KeyManagers store
file = “src/test/resources/data/keystore.jks” # Location of SSLContext’s KeyManagers store
password = “abcdef” # Password for SSLContext’s KeyManagers store
#algorithm = “” # Algorithm used SSLContext’s KeyManagers store
}

trustStore {
type = “JKS” # Type of SSLContext’s TrustManagers store
file = “src/test/resources/data/truststore.jks” # Location of SSLContext’s TrustManagers store
password = “abcdef” # Password for SSLContext’s TrustManagers store
#algorithm = “” # Algorithm used by SSLContext’s TrustManagers store
}
}
`

Error details:

`
14:02:24.978 [ERROR] i.g.a.Gatling$ - Run crashed

javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128)

at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)

at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)

at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:279)

at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:181)

at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)

at java.base/sun.security.ssl.SSLEngineImpl.decode(SSLEngineImpl.java:672)

at java.base/sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:627)

at java.base/sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:443)

at java.base/sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:422)

at java.base/javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:634)

at oracle.net.nt.SSLSocketChannel.unwrap(SSLSocketChannel.java:444)

at oracle.net.nt.SSLSocketChannel.handshake(SSLSocketChannel.java:350)

at oracle.net.nt.SSLSocketChannel.write(SSLSocketChannel.java:238)

at oracle.net.ns.NIOPacket.writeToSocketChannel(NIOPacket.java:211)

at oracle.net.ns.NIOConnectPacket.writeToSocketChannel(NIOConnectPacket.java:232)

at oracle.net.ns.NSProtocolNIO.negotiateConnection(NSProtocolNIO.java:108)

… 27 common frames omitted

Wrapped by: java.io.IOException: Received fatal alert: handshake_failure, connect lapse 201 ms.

at oracle.net.ns.NSProtocolNIO.negotiateConnection(NSProtocolNIO.java:138)

at oracle.net.ns.NSProtocol.connect(NSProtocol.java:317)

at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1438)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:518)

… 24 common frames omitted

Wrapped by: java.io.IOException: Received fatal alert: handshake_failure, connect lapse 201 ms., Authentication lapse 0 ms.

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:790)

… 24 common frames omitted

Wrapped by: java.sql.SQLRecoverableException: IO Error: Received fatal alert: handshake_failure, connect lapse 201 ms., Authentication lapse 0 ms.

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:794)

at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:688)

at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:691)

at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)

at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)

at io.gatling.jdbc.feeder.JdbcFeederSource$.apply(JdbcFeederSource.scala:30)

at io.gatling.jdbc.Predef$.jdbcFeeder(Predef.scala:26)

at computerdatabase.Extract_JDBC.(Extract_JDBC.scala:33)

… 16 common frames omitted

Wrapped by: java.lang.reflect.InvocationTargetException: null

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 io.gatling.app.Runner.run0(Runner.scala:75)

at io.gatling.app.Runner.run(Runner.scala:61)

at io.gatling.app.Gatling$.start(Gatling.scala:74)

at io.gatling.app.Gatling$.fromArgs(Gatling.scala:47)

at io.gatling.app.Gatling$.main(Gatling.scala:39)

at io.gatling.app.Gatling.main(Gatling.scala)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)

at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)

java.lang.reflect.InvocationTargetException

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)

at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)

Caused by: java.lang.reflect.InvocationTargetException

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 io.gatling.app.Runner.run0(Runner.scala:75)

at io.gatling.app.Runner.run(Runner.scala:61)

at io.gatling.app.Gatling$.start(Gatling.scala:74)

at io.gatling.app.Gatling$.fromArgs(Gatling.scala:47)

at io.gatling.app.Gatling$.main(Gatling.scala:39)

at io.gatling.app.Gatling.main(Gatling.scala)

… 6 more
`

Check the option block you’ve configured in gatling.conf: it’s in the http namespace, there’s no reason it would have an impact on the truststore and keystore to be used for a JDBC driver.

Hi Stephane,

I don’t see any option block in git config under http. Following is the complete http standard block which is in use at my end. It seems like the issue is linked to consumption of trust store and keystore jks, but I am not sure about that.

`

http {
fetchedCssCacheMaxCapacity = 200 # Cache size for CSS parsed content, set to 0 to disable
fetchedHtmlCacheMaxCapacity = 200 # Cache size for HTML parsed content, set to 0 to disable
perUserCacheMaxCapacity = 200 # Per virtual user cache size, set to 0 to disable
warmUpUrl = “https://gatling.io” # The URL to use to warm-up the HTTP stack (blank means disabled)
enableGA = true # Very light Google Analytics, please support
ssl {
keyStore {
type = “” # Type of SSLContext’s KeyManagers store
file = “” # Location of SSLContext’s KeyManagers store
password = “” # Password for SSLContext’s KeyManagers store
algorithm = “” # Algorithm used SSLContext’s KeyManagers store
}
trustStore {
type = “” # Type of SSLContext’s TrustManagers store
file = “” # Location of SSLContext’s TrustManagers store
password = “” # Password for SSLContext’s TrustManagers store
algorithm = “” # Algorithm used by SSLContext’s TrustManagers store
}
}

`

It’s definitely the issue with Gatling configuration because I tried to use the same connection string and jks files with Jmeter and I am able to get the result of my sql query. Could you please help me in debugging the issue in Gatling as majority of my script is developed in Scala.

Thanks in advance!

Definitively not a Gatling issue.
Read Oracle JDBC driver’s documentation and figure out how to configure TLS.

I understand Stephane but I didn’t do anything special in terms of configuration with Jmeter either and it worked fine there. Seems like trust store and keystore are not getting picked up in Gatling which could be causing the issue but I have no confirm way of telling that. I can’t think of anything else which could be causing the issue. If someone is able to get oracle jdbc work on their system, inputs would be highly appreciated!

I am still facing the same issue, could anyone help please?
It’s the same handshake failure error over and over again :frowning: