You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Jean-Baptiste Onofré (Jira)" <ji...@apache.org> on 2023/02/18 06:34:00 UTC

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

    [ https://issues.apache.org/jira/browse/AMQ-9093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690708#comment-17690708 ] 

Jean-Baptiste Onofré commented on AMQ-9093:
-------------------------------------------

I don't understand the issue.

The {{examples/conf/activemq-security.xml}} file points to {{{}credentials-env.properties{}}}.

If you replace {{conf/activemq.xml}} with this file (and adding {{{}jetty-demo.xml{}}}, the broker starts without problem (you might have to provide the ACTIVEMQ_ENCRYPTION_PASSWORD env variable to avoid NPE).

Anyway, both {{credentials.properties}} and {{credentials-env.properties}} are present in the {{conf}} folder.

> 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
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 5.18.0, 5.17.4
>
>
> 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:
> {code:java}
> set ACTIVEMQ_HOME=C:/apache-activemq-5.17.2
> set ACTIVEMQ_ENCRYPTION_PASSWORD=activemq
> bin/activemq start xbean:examples/conf/activemq-security.xml{code}
>  
> *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|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:
>  
> {code:java}
>  <!-- 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> {code}
>  
> 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)