IBM MQ issue using JNDI getting Exception in thread "main" JMSWMQ2013: The security authentication was not valid that was supplied for QueueManager

There is an issue regarding authentication, I could successfully pass the same using Jmeter or java code.

Please kindly let me know if anything is wrong and what to be done.

Exception in thread “main” JMSWMQ2013: The security authentication was not valid that was supplied for QueueManager ‘XXXX’ with connection mode ‘Client’ and host name ‘xxxxxxx(1416)’.

Please check if the supplied username and password are correct on the QueueManager to which you are connecting.

package simulations

import{MQGetMessageOptions, MQMessage, MQPutMessageOptions, MQQueue, MQQueueManager}
import io.gatling.core.Predef._
import io.gatling.jms.Predef._
import javax.jms._

import scala.concurrent.duration._

class Test extends Simulation {
// create a ConnectionFactory for ActiveMQ
// search the documentation of your JMS broker
// alternatively, you can create a ConnectionFactory from a JNDI lookup

val connectionFactory = new MQConnectionFactory()
connectionFactory.createConnection(“xxx”, “xx”)

val jndiBasedConnectionFactory = jmsJndiConnectionFactory

val jmsConfig = jms
.connectionFactory(jndiBasedConnectionFactory)// tried with both connectionFactory

val scn = scenario(“JMS DSL test”).repeat(1) {
exec(jms(“req reply testing”).requestReply
.textMessage(“hello from gatling jms dsl”)
.property(“test_header”, “test_value”)

setUp(scn.inject(rampUsersPerSec(10) to 1000 during (2 minutes)))

def checkBodyTextCorrect(m: Message) = {
// this assumes that the service just does an “uppercase” transform on the text
m match {
case tm: TextMessage => tm.getText == “HELLO FROM GATLING JMS DSL”
case _ => false


I didnt face the same issue as yours but my setup was like this:

In my case, i had a different context factory
I used the jmsJndiConnectionFactory to make things work

val jndiBasedConnectionFactory = jmsJndiConnectionFactory
.credentials(“user”,“pwd”) //in my case the credentials was not there

I had to use certain jar files for this

Standalone Gatling

  • place the files in /lib folder


  • add them to the dependencies section in pom.xml

also check if any additional certificates to be used

Hi Sujin, Thanks for replying, My context factory is “com.sun.jndi.fscontext.RefFSContextFactory”. I have added relevant dependencies, but yet still I face the same Issue.