![](/img/trans.png)
[英]Trying to use XInclude with Java and resolving the fragment with xml:id
[英]Is it possible to use Java system property variable in XInclude attribute href?
我正在使用 ActiveMQ Artemis 拆分代理。xml 功能并包括 xml 文件。 我正在尝试将 Java 系统属性用于 xml 文件路径。 但它正在抛出错误。
这是我正在尝试的路线。
<xi:include href="${amq.conf.broker.config}/broker-security-settings.xml"/>
我已经单独定义-Damq.conf.broker.config=/var/amq/...
。
收到以下错误
[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)
ActiveMQ Artemis 目前不支持在include
元素的href
中使用系统属性替换。 但是,这似乎是一个不错的功能,所以我为它打开了一个新的 JIRA并发送了一个 PR 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.