You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Justin Bertram (JIRA)" <ji...@apache.org> on 2017/10/25 17:47:00 UTC

[jira] [Assigned] (ARTEMIS-1473) System property BROKER_BIND_URL with parameters will not work if AMQ_USER and AMQ_PASSWORD also set

     [ https://issues.apache.org/jira/browse/ARTEMIS-1473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Bertram reassigned ARTEMIS-1473:
---------------------------------------

    Assignee: Justin Bertram

> System property BROKER_BIND_URL with parameters will not work if AMQ_USER and AMQ_PASSWORD also set
> ---------------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-1473
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1473
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>            Reporter: shoukun huai
>            Assignee: Justin Bertram
>            Priority: Minor
>
> I try to add a connection factory resource in Tomcat like this:
> {code:xml}
> <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" />
> {code}
> And pass transport configuration through system property
> {code:java}
> -DBROKER_BIND_URL=tcp://localhost:61616?compressLargeMessages=true -DAMQ_USER=xxx -DAMQ_PASSWORD=xxx
> {code}
> 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
> {code:java}
> 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;
>    }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)