javaactivemq-artemissystem-propertiesxinclude

Is it possible to use Java system property variable in XInclude attribute href?


I am using the ActiveMQ Artemis split broker.xml feature and including xml file. I am trying to use Java system property for xml file path. But it is throwing error.

Here is the line I am trying.

<xi:include href="${amq.conf.broker.config}/broker-security-settings.xml"/>

I have separately defined -Damq.conf.broker.config=/var/amq/....

Getting following error

[Fatal Error] :116:82: An include with href '${amq.conf.broker.config}/broker-security-settings.xml'failed, and no fallback element was found.
org.xml.sax.SAXParseException; lineNumber: 116; columnNumber: 82; An include with href '${amq.conf.broker.config}/broker-security-settings.xml'failed, and no fallback element was found.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
    at org.apache.activemq.artemis.utils.XMLUtil.readerToElement(XMLUtil.java:84)
    at org.apache.activemq.artemis.utils.XMLUtil.streamToElement(XMLUtil.java:57)
    at org.apache.activemq.artemis.utils.XMLUtil.urlToElement(XMLUtil.java:66)
    at org.apache.activemq.artemis.core.config.FileDeploymentManager.readConfiguration(FileDeploymentManager.java:70)
    at org.apache.activemq.artemis.integration.FileBroker.start(FileBroker.java:61)
    at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:85)
    at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:150)
    at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:98)
    at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:125)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:129)
    at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:49)
java.lang.NullPointerException
    at org.apache.activemq.artemis.integration.FileBroker.getServer(FileBroker.java:131)
    at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:112)
    at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:150)
    at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:98)
    at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:125)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:129)
    at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:49)

Solution

  • ActiveMQ Artemis doesn't currently support using system property substitution in the href of an include element. However, that seems like a nice feature to have so I've opened a new JIRA for it and sent a PR.