IBM MQ issue using JNDI getting Exception in thread "main" com.ibm.msg.client.jms.DetailedJMSSecurityException: 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” com.ibm.msg.client.jms.DetailedJMSSecurityException: 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 com.ibm.mq.{MQGetMessageOptions, MQMessage, MQPutMessageOptions, MQQueue, MQQueueManager}
import com.ibm.mq.constants.CMQC
import com.ibm.mq.jms._
import com.ibm.msg.client.wmq.common.CommonConstants
import io.gatling.core.Predef._
import io.gatling.jms.Predef._
import javax.jms._
import com.ibm.msg.client.jms.JmsConnectionFactory._
import com.ibm.msg.client.jms.JmsFactoryFactory._
import com.ibm.msg.client.wmq.WMQConstants._

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.setHostName("xxxxx)
connectionFactory.setPort(1416)
connectionFactory.setQueueManager(“xxx”)
connectionFactory.setChannel(“xx”)
connectionFactory.setTransportType(CommonConstants.WMQ_CM_CLIENT)
connectionFactory.createConnection(“xxx”, “xx”)

val jndiBasedConnectionFactory = jmsJndiConnectionFactory
.connectionFactoryName("")
.url("<file:////Bindingfilepath>")
.credentials(“user”,“password”)
.contextFactory(“com.sun.jndi.fscontext.RefFSContextFactory”)

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

val scn = scenario(“JMS DSL test”).repeat(1) {
exec(jms(“req reply testing”).requestReply
.queue(“jmstestq”)
.textMessage(“hello from gatling jms dsl”)
.property(“test_header”, “test_value”)
.jmsType(“test_jms_type”)
.check(simpleCheck(checkBodyTextCorrect)))
}

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

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
}
}
}

Hello,

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
.connectionFactoryName("")
.url(“host:port”)
.credentials(“user”,“pwd”) //in my case the credentials was not there
.property(“queueManager”,“xx”)
.property(“channel”,“x”)
.contextFactory()

I had to use certain jar files for this

Standalone Gatling

  • place the files in /lib folder

Maven

  • 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.