javax.security.auth.login.FailedLoginException: user name is null in Fabric client with clustered ActiveMQ

Solution Verified - Updated -

Issue

  • We create a cluster of AMQ brokers using fabric:mq-create, and then connect to them using a bundle that utilizes a Camel Route.
  • We are using the discovery url - discovery:(fabric:mymq), and setting up the ActiveMQXAConnectionFactory as below:
<bean id="activemq-factory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
        <property name="brokerURL" value="${amq.broker.url}"></property>
        <property name="userName" value="${amq.broker.username}"></property>
        <property name="password" value="${amq.broker.password}"></property>
    </bean>

and a ResourceManager as:

<bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager"
          init-method="recoverResource">
        <property name="transactionManager" ref="recoverableTxManager"></property>
        <property name="connectionFactory" ref="activemq-jms-xa-connection-factory"></property>
        <property name="resourceName" value="activemq.default"></property>
    </bean>
  • When the bundle gets deployed, it keeps on giving me an error with the stack trace shown below. What user name / password is it missing? How can we fix this?
javax.transaction.SystemException: Failed to create ConnectionAndWrapperNamedXAResource, User name [null] or password is invalid.
  at org.apache.activemq.jms.pool.GenericResourceManager$Recovery$1.getNamedXAResource(GenericResourceManager.java:161)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at org.apache.geronimo.transaction.manager.RecoverTask.run(RecoverTask.java:49)[org.apache.aries.transaction:org.apache.aries.transaction.manager:1.0.1.redhat-610379]
  at org.apache.geronimo.transaction.manager.ExponentialtIntervalRetryScheduler$TaskWrapper.run(ExponentialtIntervalRetryScheduler.java:50)[org.apache.aries.transaction:org.apache.aries.transaction.manager:1.0.1.redhat-610379]
  at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_51]
  at java.util.TimerThread.run(Timer.java:505)[:1.7.0_51]
Caused by: javax.jms.JMSSecurityException: User name [null] or password is invalid.
  at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:52)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1408)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1513)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at org.apache.activemq.ActiveMQXAConnection.createSession(ActiveMQXAConnection.java:74)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at org.apache.activemq.ActiveMQXAConnection.createXASession(ActiveMQXAConnection.java:61)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at org.apache.activemq.jms.pool.GenericResourceManager$Recovery$1.getNamedXAResource(GenericResourceManager.java:155)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
... 4 more
Caused by: java.lang.SecurityException: User name [null] or password is invalid.
  at org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:80)
  at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:97)
  at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:764)
  at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:79)
  at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139)
  at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:294)
  at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:148)
  at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
  at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
  at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:270)
  at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
  at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)[org.apache.activemq:activemq-osgi:5.9.0.redhat-610379]
  at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]
Caused by: javax.security.auth.login.FailedLoginException: user name is null
  at io.fabric8.jaas.ZookeeperLoginModule.login(ZookeeperLoginModule.java:106)
  at org.apache.karaf.jaas.boot.ProxyLoginModule.login(ProxyLoginModule.java:83)[karaf-jaas-boot.jar:]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_51]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_51]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_51]
  at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_51]
  at javax.security.auth.login.LoginContext.invoke(LoginContext.java:775)
  at javax.security.auth.login.LoginContext.access$000(LoginContext.java:205)
  at javax.security.auth.login.LoginContext$5.run(LoginContext.java:697)
  at javax.security.auth.login.LoginContext$5.run(LoginContext.java:695)
  at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_51]
  at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:694)
  at javax.security.auth.login.LoginContext.login(LoginContext.java:602)
  at org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:73)
... 13 mor

Environment

  • Red Hat JBoss Fuse
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.