views:

282

answers:

3

Hello fellows,

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"&gt;

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

+1  A: 

I ran into a very similar problem some time ago. The solution was very simple, however:

I left programming behind, took some cash and my passport, boarded the first plane for Sri Lanka and now am studying the mating ritual of the Ceylon Wood Pigeon. I've found out they are more likely to mate when exposed to the Slayer album Reign in Blood, and now these gracious birds are slowly making it back to Lest Concern in the extinction-risk scale.

Hope it helped you!

SriLankaWoodenPigeon
+1  A: 

Without looking too closely at your specific problem I'd recommend going over the xmlns:* and xsi:schemalocation=... lines with a fine tooth comb. You might just find something unexpected.

Uberpuppy
A: 

Just to give you guys some feedback, the problem was solved a while ago by specifying the version number for the activemq xsd, e.g.:

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

However I haven't been loading the configs like that anymore (though I didn't leave programming behind to research the magnificent Ceylon Wood Pigeon mating rituals as our friend suggested, though I'm seriously considering to now). I am now working with the broker running outside my application, so loading the configurations is done a bit different.

Eduardo Z.