JMS with Red Hat JBoss A-MQ not working when jaas realm is enabled.

I have a simulation with this JMSConfiguration:

val jmsConfig = jms
.connectionFactoryName(“ConnectionFactory”)
.url(“tcp://amq1.lnx.example.com:61616”)
.credentials(“admin”, “password”)
.contextFactory(classOf[ActiveMQInitialContextFactory].getName)
.listenerCount(1)
.usePersistentDeliveryMode

While “jaasAuthenticationPlugin” is enabled in activemq.xml this fails with the exception posted below indicating that the username is “null” or password is invalid.

In the broker logs I also see:
2015-09-14 13:45:46,359 | INFO | e[amq1] Task-153 | TransportConnection | emq.broker.TransportConnection$3 1076 | 121 - org.apache.activemq.activemq-osgi - 5.9.0.redhat-611442 | Stopping tcp://192.168.102.11:35546 because Failed with SecurityException: User name [null] or password is invalid.

In the docs I can see the option: "disableAnonymousConnect optional, by default, connection won’t use the above credentials".
If I try to change my jmsConfig to:
val jmsConfig = jms
.connectionFactoryName(“ConnectionFactory”)
.url(“tcp://amq1.lnx.example.com:61616”)
.credentials(“admin”, “password”)
.contextFactory(classOf[ActiveMQInitialContextFactory].getName)
.listenerCount(1)
.usePersistentDeliveryMode
.disableAnonymousConnect

I get this error:
4:25:51.557 [ERROR] i.g.c.ZincCompiler$ - /home/gatling/gatling-charts-highcharts-bundle-2.1.7/user-files/simulations/amq/AMQInboundOutboundSimulation.scala:17: value disableAnonymousConnect is not a member of io.gatling.jms.JmsProtocolBuilder
possible cause: maybe a semicolon is missing before value disableAnonymousConnect’?`

This has been solved.

io.gatling.core.config.Credentials needs to be included for credentials to work.

import io.gatling.core.config.Credentials

And the jmsConfig:

val jmsConfig = jms
.connectionFactoryName(“ConnectionFactory”)
.url(“tcp://amq1.lnx.example.com:61616”)
.credentials(“admin”, “password”)
.disableAnonymousConnect
.contextFactory(classOf[ActiveMQInitialContextFactory].getName)
.listenerCount(1)
.usePersistentDeliveryMode
.messageMatcher(idMatcher)

Thanks for providing the solution. Will be helpful in future.

facing the same issue. The proposed solution to resolve the credentials does not work for me still.Wondering if the gatling test framework version you are using is 2.1.7 ?