Monday, April 23, 2012

Embedded ActiveMQ broker in Spring/OSGi problems

I ran into a very disturbing issue that's been puzzling me for a while and I was wondering if anyone could give me some insight on this.



Basically, what I'm trying to do is set up an embedded ActiveMQ broker in the Spring context of one of my OSGi bundles (in Felix). I have downloaded the bundle and all dependencies listed in this page. They are all up and running. Here's what my Spring context xml file looks like:



<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 -->




This looks pretty ok to me. However, during the startup I get the following message:



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'.


I've found someone experiencing a similar issue in Eclipse (which I'm also using) and they apparently solved it by making Eclipse point to the bundled .xsd file in the ActiveMQ jar. I attempted to do the same, alas, to no avail.



Does anybody have any ideas on what i might be missing here?



Thanks in advance.





No comments:

Post a Comment