2010-05-19 64 views
1

我遇到了令人困扰的一个令我困惑的问题,我想知道有没有人能给我一些见解。Spring/OSGi中嵌入式ActiveMQ代理问题

基本上,我想要做的是在我的一个OSGi包(在Felix中)的Spring上下文中设置嵌入式ActiveMQ代理。我已下载了this页面中列出的软件包和所有依赖项。他们都在运转。下面是我的Spring上下文XML文件的样子:

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:aop="http://www.springframework.org/schema/aop" 
xmlns:osgix="http://www.springframework.org/schema/osgi-compendium" 
xmlns:tx="http://www.springframework.org/schema/tx" 
xmlns:util="http://www.springframework.org/schema/util" 
xmlns:jms="http://www.springframework.org/schema/jms" 
xmlns:amq="http://activemq.apache.org/schema/core" 
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
    http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd 
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd 
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd 
    http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd 
    http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> 

<!-- some uninteresting parts ommited --> 

<!-- JMS Configurations --> 

<amq:broker useJmx="false" start="true"> 
    <amq:transportConnectors> 
    <amq:transportConnector uri="tcp://localhost:0"/> 
    </amq:transportConnectors> 
</amq:broker> 

<!-- other ActiveMQ configs such as destinations and whatnot --> 

这看起来相当好的给我。然而,在启动过程中,我得到了以下信息:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 41 in XML document from URL [bundle://121.0:0/META-INF/spring/bundle-context.xml] 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'. 

我发现有人遇到在Eclipse(这我还使用)一个类似的问题,他们显然是做的Eclipse点捆绑的解决了这个问题。 ActiveMQ jar中的xsd文件。我试图这样做,唉,无济于事。

有没有人有什么想法,我可能会在这里失踪?

在此先感谢。

回答

1

没有仔细观察你的具体问题,我建议通过xmlns:*和xsi:schemalocation = ...细齿梳。你可能会发现一些意想不到的事

+1

即使这被接受,它也不是一个好的答案。这应该是一个评论。 – 2012-04-24 06:27:26

4

只给你们一些反馈,问题得到解决前一段时间通过指定的版本号为ActiveMQ的XSD,如:

http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd" 

但是我没有被加载这样的CONFIGS了(虽然我没有留下节目来研究我们的朋友建议的壮丽的锡兰木鸽交配仪式,尽管我现在正在认真考虑)。我现在正在与我的应用程序之外运行的代理合作,因此加载配置有点不同。

+2

如果您发现问题的解决方案,然后将其作为答案发布,您还应该接受该答案,以便其他具有相同问题的人员能够找到答案。 – 2012-04-24 06:29:23

0

列出捆绑包“org.apache.activemq-core”(例如,equinox中的'bundle 88'),并查找它导出activemq.xsd文件的路径(启动META-INF ...) ,并确保你的包使用amq broker xml配置导入它(例如,将其添加到osgi.bnd的Import-Packages:)