You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Sreenivas K (Jira)" <ji...@apache.org> on 2022/09/21 08:26:00 UTC

[jira] [Created] (AMQ-9093) AMQ startup failing if we load activemq-security.xml from examples/ folder

Sreenivas K created AMQ-9093:
--------------------------------

             Summary: AMQ startup failing if we load activemq-security.xml from examples/ folder
                 Key: AMQ-9093
                 URL: https://issues.apache.org/jira/browse/AMQ-9093
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.17.2
            Reporter: Sreenivas K


We started using ActiveMQ-5.17.2 with security features enabled. So i followed the documentation Security ([https://activemq.apache.org/security)] and  encrypted passwords ([https://activemq.apache.org/encrypted-passwords)] as we wanted to use password encryption. Startup failed stating *conf/credentials.properties file not found despite having conf/credentials-enc.properties* file{*}.{*}

I made all changes suggested in those documentations, i deleted *conf/credentials.properties* as i have {*}conf/credentials-enc.properties{*}. But AMQ still  looking for {*}conf/credentials.properties{*}.

I banged my head for some time and thought to try first with example provided in the distribution zip itself. 

There also same issue. This can be reproducible easily. Just download the zip and run these commands:

_*set ACTIVEMQ_HOME=C:\\apache-activemq-5.17.2\\*_

_*set ACTIVEMQ_ENCRYPTION_PASSWORD=activemq*_
_*bin/activemq start xbean:examples/conf/activemq-security.xml*_

 

*Below are logs:*

ACTIVEMQ_HOME: C:\apache-activemq-5.17.2
ACTIVEMQ_BASE: C:\apache-activemq-5.17.2
ACTIVEMQ_CONF: C:\apache-activemq-5.17.2\conf
ACTIVEMQ_DATA: C:\apache-activemq-5.17.2\data
Loading message broker from: *xbean:examples/conf/activemq-security.xml*
 INFO | Using Persistence Adapter: MemoryPersistenceAdapter
 INFO | JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
 INFO | Apache ActiveMQ 5.17.2
 INFO | Listening for connections at: tcp:....
 INFO | Connector openwire started
 INFO | Apache ActiveMQ 5.17.2 (localhost, ) started
 INFO | For help or more information please see: http://activemq.apache.org
 WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is *java.io.FileNotFoundException: C:\apache-activemq-5.17.2\conf\credentials.properties* (The system cannot find the file specified)
 WARN | Failed startup of context o.e.j.w.WebAppContext@2e3572e8\{ActiveMQ Console,/admin,file:///C:/apache-activemq-5.17.2/webapps/admin/,UNAVAILABLE}
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: C:\apache-activemq-5.17.2\conf\credentials.properties (The system cannot find the file specified)

{color:#FF0000}*Caused by: java.io.FileNotFoundException: C:\apache-activemq-5.17.2\conf\credentials.properties (The system cannot find the file specified)*{color}
        at java.io.FileInputStream.open0(Native Method) ~[?:?]
        at java.io.FileInputStream.open(FileInputStream.java:219) ~[?:?]

 

So to find out, who's looking for this file still .. i created one empty *credentials.properties under conf and then found this:*

 

org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'connectionFactory' defined in ServletContext resource {color:#FF0000}[/WEB-INF/webconsole-embedded.xml{color}]: Could not resolve placeholder 'activemq.username' in value "${activemq.username}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'activemq.username' in value "${activemq.username}"

 

I opened that file,{*}webconsole-embedded.xml,{*} and found this:

 

 <!-- Allows us to use system properties as variables in this configuration file -->
  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="locations">
          *<value>file:${activemq.conf}/credentials.properties</value>*
      </property>      
  </bean> 

 

So my question do we need to change this bean definition to load *credentials-enc.properties (no where mentioned about this in the documentation)* if we are going with encrypted passwords approach.

Also, i see the params in this file used for broker authentication in *webconsole-embedded.xml*

then what is the use of *users.properties ?* I see usernames defined in *credentials*.properties* and *users.properties* are different. So i'm confused.

*jetty-realm.properties -* used for webconsole authentication i believe. Correct me if i'm wrong on this.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)