Failed to configure broker-bean for ActiveMQ

I am having trouble setting up an ActiveMQ broker through an external xBean-processed XML file. ANY help, tips, pointers, tips or even applause is currently being evaluated. Here is my problem:

I am trying to use an external .xml file to configure a broker. I have the following code in my spring context:

<bean id="brokerFactory" class="org.apache.activemq.xbean.BrokerFactoryBean">  
 <property name="config" value="file:c:/activemq.xml" />  
 <property name="start" value="false" />  
</bean>

This should be linked to the configuration file without any additional problems. This is what my activemq.xml file looks like:

<beans 
xmlns="http://www.springframework.org/schema/beans" 
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

 <amq:broker useJmx="true" xmlns="http://activemq.apache.org/schema/core">

    <networkConnectors>
      <!-- 
      <networkConnector uri="multicast://default?initialReconnectDelay=100" />
      <networkConnector uri="static://(tcp://localhost:61616)" />
       -->
    </networkConnectors>

    <persistenceFactory>
      <journalPersistenceAdapterFactory journalLogFiles="5" dataDirectory="${basedir}/target/foo" />

    </persistenceFactory>

    <transportConnectors>
      <transportConnector uri="tcp://localhost:61636" />
    </transportConnectors>
  </amq:broker>
</beans>

As you can see, this is pretty standard. When I run my packages, I get the following exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name     'brokerManager' defined in URL [bundle://7.0:0/META-INF/spring/bundle-context.xml]: Cannot resolve reference to bean 'brokerFactory' while setting  bean property 'brokerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerFactory' defined in URL [bundle://7.0:0/META-INF/spring/bundle-context.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from OSGi resource[file:c:/activemq.xml|bnd.id=7|bnd.sym=genericenqueuer-engine] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be  found for element 'amq:broker'.

. "amq:" "amq:" (<broker> <amq:broker>) activemq.xsd. , .xsd, , . activemq.xsd, :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerFactory' defined in URL [bundle://7.0:0/META-INF/spring/bundle-context.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://activemq.apache.org/schema/core

xbean- spring 3.7, . .xsd com.springsource.org.apache.activemq-5.3.0.jar , . Geronimo Jira .

- ?

,
.

+3
1

. -, brokerFactory osgi <osgi:service ...> , bean. - brokerFactory . , ...

+1

Source: https://habr.com/ru/post/1759221/


All Articles