|« Parallel line checker board and chinese writing illusions||Dependancy Injection in Layman's Terms »|
Invalid ActiveMQ Schema Name SpaceFebruary 1st, 2009
Newer versions of ActiveMQ have support for XML name space schema declarations to allow easier configuration of container beans. Adding the following XMLNS declaration to the
beans container will allow you to use ActiveMQ’s
amq name space.
When the application is deployed (in Tomcat) it will work as expected, however if you try to run it under Eclipse the container fails to start with the message:
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://activemq.apache.org/schema/core/activemq-core.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not
. Caused by: 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'. </xsd>
amq:broker maybe replaced with
amq:connectionFactory depending on which name elements you have actually used.
In order for Eclipse to understand the
amq name space you must add xbean support for ActiveMQ. This is achieved by adding
xbean-spring-3.4.jar to your dynamic web project.
According to the ActiveMQ website the XSD declaration will be automatically fished out of the jar and used to help Eclipse give you features like command completion for the XML schema. In fact what happens, is that Eclipse lights up like a Christmas tree moaning that it can’t find the schema declaration. Below is a set of instructions to tell Eclipse how to associate the
activemq-core.xsd url with the
activemq-core.xsd found in the jar file which is shipped as part of ActiveMQ.
- Select Windows->Preferences from the Eclipse menu bar.
- Select XML->XML Catalog from the left hand configuration tree.
- Highlight User Specified Entries and select Add.
- The Add XML Catalog Entry windows appears.
- In the Location enter the path to the activemq-all jar, then add !/activemq.xsd to the end of the jar name. e.g.
- Under KeyType enter Namespace Name
- and under Key enter http://activemq.apache.org/schema/core
- then click Ok.
- Now we need to do the same for the other name space file, so hit Add again.
- In the Location enter the path to the activemq-all jar, then add !/activemq.xsd to the end of the jar name. e.g. jar:file:C:/Java/libs/activemq/apache-activemq-5.2.0/activemq-all-5.2.0.jar!/activemq.xsd
- Under KeyType enter Schema Location
- and under Key enter http://activemq.apache.org/schema/core/activemq-core.xsd
- Click Ok, Ok.
The Spring IDE should do its thing and the red error markers will disappear.
In step 5 till 13 I used:
Key Type: Schema Location
But will I remember to upgrade to a new version?
If anyone comes across this problem again and finds a solution could you post it up here - I'll do the same if I can manage this. Two days now :(