Search code examples
spring-bootauthenticationsecurityactivemq-artemis

AMQ229031: Unable to validate user from /x.x.x.x:xxx. Username: admin; SSL certificate subject DN: unavailable


I am trying to create a queue with ActiveMQ Artemis (e.g. artemis1) and send a message to it using Spring Boot. I have the Docker instance running using the official ActiveMQ Artemis image, but once I send the message I am getting the below error from the container.

Caused by: org.apache.activemq.artemis.api.core.ActiveMQSecurityException: AMQ229031: Unable to validate user from /172.18.0.1:53864. Username: admin; SSL certificate subject DN: unavailable
 23 common frames omitted

My configuration class looks like this:

@Configuration
public class MessagingConfig {
 
    private static final String ARTEMIS_BROKER_URL = "tcp://localhost:61616";
    private static final String ARTEMIS_USERNAME = "admin";
    private static final String ARTEMIS_PASSWORD = "***";

    @Bean
    public ActiveMQConnectionFactory connectionFactory() throws JMSException {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
        connectionFactory.setBrokerURL(ARTEMIS_BROKER_URL);
        connectionFactory.setUser(ARTEMIS_USERNAME);
        connectionFactory.setPassword(ARTEMIS_PASSWORD);
        UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter=new UserCredentialsConnectionFactoryAdapter();
        userCredentialsConnectionFactoryAdapter.setUsername("admin");
        userCredentialsConnectionFactoryAdapter.setPassword("***");
        userCredentialsConnectionFactoryAdapter.setTargetConnectionFactory(connectionFactory);

        return connectionFactory;
    }

    @Bean
    public JmsTemplate jmsTemplate() throws JMSException {
        JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory());
        // Additional configuration for JmsTemplate if needed
        return jmsTemplate;
    }
    @Bean
    public ActiveMQQueue sampleQueue() {
        return new org.apache.activemq.artemis.jms.client.ActiveMQQueue("artemis1");
    }
}

Also, my application.properties looks like this:

spring.artemis.broker-url=tcp://localhost:61616
spring.artemis.user=admin
spring.artemis.password=****

I cannot also login to the console: enter image description here

This is the error I am getting in the broker log:

2024-01-17 15:11:33,267 WARN  [io.hawt.system.Authenticator] Login failed due to: User does not exist: admin

Can anyone help me with this?

I tried connecting to Docker apache/activemq-artemis, but I am not able due to:

AMQ222216: Security problem while authenticating: AMQ229031: Unable to validate user from /172.18.0.1:53840. Username: admin; SSL certificate subject DN: unavailable.

Is there a way to disable SSL stuff and to make the login possible with username and password?


Solution

  • Based on the information you provided you're trying to pass the username admin. However, if you are using an official Docker image from ActiveMQ Artemis as described in the documentation then the default username & password is artemis.