I have an activemq broker and I want to split its configuration into multiple files. I want to prepare a separate configuration file, which will be generated automatically and which will contain only definitions of queues.
File 1: activemq.xml
<beans ...>
<broker ...>
</broker>
</beans>
File 2: queues.xml
<beans ...>
<broker ...>
<destinations>
<queue physicalName="q1"/>
</destinations>
</broker>
</beans>
I tried to use:
Spring import:
<import resource="queues.xml"/>
but got
ERROR: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#1' defined in class path resource [queues.xml]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: org.apache.activemq:type=Broker,brokerName=localhost org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#1' defined in class path resource [queues.xml]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: org.apache.activemq:type=Broker,brokerName=localhost
XInclude:
activemq.xml:
<beans ...
xmlns:xi="http://www.w3.org/2001/XInclude"
>
<broker ...>
<xi:include href="queues.xml" parse="xml"/>
</broker>
</beans>
but got
ERROR: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 142 in XML > document from class path resource [activemq.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 142; columnNumber: 45; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'xi:include'. org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 142 in XML document from class path resource [activemq.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 142; columnNumber: 45; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'xi:include'.
Xml entities activemq.xml
<!DOCTYPE beans [
<!ENTITY queues SYSTEM "queues.xml">
]>
<beans ...>
<broker ...>
&queues;
</broker>
</beans>
but got
ERROR: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 28 in XML document from class path resource [activemq.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 3; Element type "beans" must be declared. org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 28 in XML document from class path resource [activemq.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 3; Element type "beans" must be declared.
Any ideas? Thanks in advance.