我在通过 xBean 解析的外部 XML 文件配置 ActiveMQ 代理时遇到问题。在这一点上,任何帮助、提示、指示、提示或什至欢呼都会受到赞赏。这是我的问题:
我正在尝试使用外部 .xml 文件来配置代理。我的弹簧包上下文中有以下代码:
<bean id="brokerFactory" class="org.apache.activemq.xbean.BrokerFactoryBean">
<property name="config" value="file:c:/activemq.xml" />
<property name="start" value="false" />
</bean>
这应该与配置文件链接,没有其他问题。这是我的 activemq.xml 文件的样子:
<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>
如您所见,这是一个非常标准的。开始我的捆绑包时,出现以下异常:
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'.
我已经为所涉及的 namaspaces 尝试了几种配置。使用带有和不带有"amq:"
声明 ( <broker>
and <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 版,可以在这里找到。我尝试从我的com.springsource.org.apache.activemq-5.3.0.jar
捆绑文件中提取 .xsd 文件并将其导出到我的一个捆绑包中的一个包上,但解析器似乎仍然找不到它。我还在 Geronimo Jira上针对该问题发布了一个错误。
任何人都可以阐明这个问题吗?
在此先感谢,
爱德华多。