Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.3.0
-
None
-
None
Description
I try to add a connection factory resource in Tomcat like this:
<Resource name="jms/connectionFactory" auth="Container" type="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory" factory="org.apache.naming.factory.BeanFactory" minLargeMessageSize="1048576" user="xxx" password="xxx" />
And pass transport configuration through system property
-DBROKER_BIND_URL=tcp://localhost:61616?compressLargeMessages=true -DAMQ_USER=xxx -DAMQ_PASSWORD=xxx
The final URL will be "tcp://localhost:61616?compressLargeMessages=true?user=xxx&password=xxx", and we lost compressLargeMessages and user.
In org.apache.activemq.artemis.jms.client.DefaultConnectionProperties.java from 2.3.0
static { String host = getProperty("localhost", "AMQ_HOST", "org.apache.activemq.AMQ_HOST"); String port = getProperty("61616", "AMQ_PORT", "org.apache.activemq.AMQ_PORT"); DEFAULT_BROKER_HOST = host; DEFAULT_BROKER_PORT = Integer.parseInt(port); String url = getProperty("tcp://" + host + ":" + port, "org.apache.activemq.BROKER_BIND_URL", "BROKER_BIND_URL"); DEFAULT_USER = getProperty(null, "AMQ_USER", "org.apache.activemq.AMQ_USER"); DEFAULT_PASSWORD = getProperty(null, "AMQ_PASSWORD", "org.apache.activemq.AMQ_PASSWORD"); if (DEFAULT_USER != null && DEFAULT_PASSWORD != null) { url += "?user=" + DEFAULT_USER + "&password=" + DEFAULT_PASSWORD; } DEFAULT_BROKER_BIND_URL = url; // TODO: improve this once we implement failover:// as ActiveMQ5 does DEFAULT_BROKER_URL = DEFAULT_BROKER_BIND_URL; }
I don't think we need append user&password to url, cause ActiveMQConnectionFactory will take care of user/password, and this is the only usage of the url as far as i know.