I'm getting the following error when trying to connect to ActiveMQ Artemis Queue deployed on JBoss EAP 7.1.
Error: DefaultMessageListenerContainer: Could not refresh JMS Connection for destination 'jms/queue/QueueA' - retrying using FixedBackOff{interval=5000, currentAttempts=139, maxAttempts=unlimited}. Cause: AMQ119031: Unable to validate user
Here is the code I'm using:
@Bean public DefaultMessageListenerContainer myFactory() throws NamingException {
DefaultMessageListenerContainer listenerContainer = new DefaultMessageListenerContainer();
listenerContainer.setConnectionFactory(getConnectionFactory());
listenerContainer.setDestinationName("jms/queue/QueueA");
listenerContainer.setMessageListener(new MessageReceiver());
return listenerContainer;
}
private ConnectionFactory getConnectionFactory() throws NamingException {
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, org.wildfly.naming.client.WildFlyInitialContextFactory);
env.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
env.put(Context.SECURITY_PRINCIPAL, "Username");
env.put(Context.SECURITY_CREDENTIALS, "Password");
InitialContext ic = new InitialContext(env);
return (ConnectionFactory) ic.lookup("jms/RemoteConnectionFactory");
}