Tech stack and tech notes:
Spring-boot: 2.3.0.RELEASE Camel: 2.25.1 Artemis: 2.13.0 Artemis has been setup to use a ssl Using org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory for connection factory. Summary Of Issue:
When using a bean to configure the Camel JMS component fails with JMSSecurityException: AMQ229031: Unable to validate user. Attached application is working with standalone broker.
I have attached a small application artemis-ssl-docker.zip artemis-ssl-docker.zip which reproduces the problem. I am using the following Artemis docker image which has security enabled by default.
Note: If I try to consume from 2 queues using same jmscomponent it says error. we have provided correct certificate and we are able to see 1 connection. with normal tcp without ssl it works fine.
My docker-compose file:
version: '3.3'
services:
artemis-jms:
image: vromero/activemq-artemis
container_name: artemis-jms
ports:
- "8161:8161"
- "61616:61616"
environment:
- ARTEMIS_USERNAME=artemis
- ARTEMIS_PASSWORD=artemis
Steps to reproduce
Run the docker image using the docker-compose file. Run the application The following is in the error logs:
Caused by: org.springframework.jms.JmsSecurityException: AMQ229031: Unable to validate user from /localhost:54004. Username: null; SSL certificate subject DN: unavailable; nested exception is javax.jms.JMSSecurityException: AMQ229031: Unable to validate user from /localhost:54004. Username: null; SSL certificate subject DN: unavailable
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:291)
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:487)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:570)
at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:658)
at com.example.spring.artemis.ssl.SSLExample.main(SSLExample.java:30)
... 8 more
Caused by: javax.jms.JMSSecurityException: AMQ229031: Unable to validate user from /localhost:54004. Username: null; SSL certificate subject DN: unavailable
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:409)
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:319)
at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:288)
at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:237)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1294)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:670)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:295)
at org.apache.activemq.artemis.jms.client.ActiveMQConnection.authorize(ActiveMQConnection.java:675)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:802)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:267)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:262)
at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
Comment From: wilkinsona
Thanks for the report. Given the involvement of JMSComponent
and it being part of Apache Camel, I think this would be better investigated by the Camel community in the first instance at least. If that identifies a problem with Spring Boot or Spring Framework's JMS support or the problem can be reproduced without using Camel then please let us know and we can take another look.
Comment From: rokkakasu
Hi Team,
I am able to reproduce without using camel component only with JMS and Spring boot. spring-boot-artemis-examples-master2.zip
Thanks, R Ramarajan.
Comment From: rokkakasu
Hi Team,
Thanks for the Quick response. The issue is replicated with Spring boot connecting to Artemis broker image inside Docker container only. with standalone broker it works fine.
Thanks, R Ramarajan.
Comment From: wilkinsona
The sample is using Spring Boot 1.5 which is no longer supported.
The issue is replicated with Spring boot connecting to Artemis broker image inside Docker container only. with standalone broker it works fine.
Spring Boot also isn't involved in the communication between the Artemis client and broker and is unaware of whether or not the broker is running inside a Docker container. As such, I think it's unlikely to be the cause of the problem.
Comment From: rokkakasu
Hi Team,
Sorry to raise again. I have tested again with Artemis 2.13.0 and Spring 2.3.0 facing the same issue.
The issue is either with Spring boot or Artemis. please update ssl configuration in in below documentation. https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-artemis
spring-boot-artemis-examples-master - Copy.zip
Thanks, R Ramarajan.
Comment From: wilkinsona
You are configuring the connection factory yourself and it's the connection factory that is unable to establish a connection to the broker. Unfortunately, it's not clear to me why you think that this is an issue with Spring Boot as it doesn't appear to be involved with the component that is failing. It looks like a configuration problem or an Artemis problem to me. If you can provide a complete example that works when you use Artemis directly and fails when you try to use it via Spring Framework's JMS support then we can take another look.
Comment From: rokkakasu
Hi Team The issue is replicated without using Spring boot, I have used only Camel and Artemis Core libraries. Raising ticket with Camel team, Will update the reference and resolution once provided
Comment From: rokkakasu
Hi Team, The issue got resolved when we upgrade to 2.15.0 Artemis.
https://issues.apache.org/jira/browse/ARTEMIS-2905 it was not a spring boot or Camel issue. https://issues.apache.org/jira/browse/CAMEL-15551
Thanks, R Ramarajan.