You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Paul Smith <ps...@aconex.com> on 2007/09/03 13:06:47 UTC
AMQ 4.1 and Spring XML beans
Confused! This works (as expected):
<amq:broker useJmx="true" persistent="true">
<amq:persistenceAdapter>
<amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
</amq:persistenceAdapter>
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:0" />
</amq:transportConnectors>
</amq:broker>
But this doesn't which is sort of copied from the XML guide on the
website:
<amq:broker useJmx="true" persistent="true">
<amq:persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="$
{activemq.base}/activemq-data" dataSource="#derby-ds"/>
</amq:persistenceAdapter>
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:0" />
</amq:transportConnectors>
</amq:broker>
I get this error after starting up Spring:
Exception in thread "main"
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: L
ine 15 in XML document from class path resource [amq.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 'journaledJDBC'.
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 'journaledJDBC'.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXPar
seException(ErrorHandlerWrapper.java:236)
Now, after looking at the XML schema defined here:
http://people.apache.org/repository/org.apache.activemq/xsds/activemq-
core-4.1-SNAPSHOT.xsd
The journaledJDBC doesn't match the XSD for the persistenceAdapator
element, and so is of course complaining. Is the XML docs on the
ActiveMQ website out of date?
What I really want is an embedded AMQ broker using the _fastest_
persistence mechanism possible. I'm not so worried about lost
messages or HA. I just want to receive messages as fast as possible
while a slower consumer processes them, and if the process exits, to
hopefully come back and keep processing saved messages. (my app,
Apache Pinpoint, is indexing log4j event objects received locally via
sockets, so the Lucene indexing could be slower rate than reception
during high volume and I'd rather not slow down the producer).
Complete Spring XML config follows:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
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.xsd
http://activemq.org/config/1.0 http://people.apache.org/repository/
org.apache.activemq/xsds/activemq-core-4.1-SNAPSHOT.xsd">
<!-- lets create an embedded ActiveMQ Broker -->
<amq:broker useJmx="true" persistent="true">
<!-- <amq:persistenceAdapter>
<amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
</amq:persistenceAdapter>
-->
<amq:persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="$
{activemq.base}/activemq-data" dataSource="#derby-ds"/>
</amq:persistenceAdapter>
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:0" />
</amq:transportConnectors>
</amq:broker>
<!-- ActiveMQ destinations to use -->
<amq:queue id="destination"
physicalName="pinpointBufferedEventQueue"/>
<!-- JMS ConnectionFactory to use, configuring the embedded broker
using XML -->
<amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
<!-- Spring JMS Template -->
<bean id="jmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<!-- lets wrap in a pool to avoid creating a connection per
send -->
<bean
class="org.springframework.jms.connection.SingleConnectionFactory">
<property name="targetConnectionFactory">
<ref local="jmsFactory" />
</property>
</bean>
</property>
<property name="defaultDestination" ref="destination" />
</bean>
<bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
<property name="databaseName" value="derbydb"/>
<property name="createDatabase" value="create"/>
</bean>
</beans>
Yours in Spring/XML/AMQ4.1x ignorance,
cheers,
Paul Smith
Re: The matching wildcard is strict error with AMQ 5 (was Re: AMQ 4.1 and Spring XML beans)
Posted by Albert Strasheim <fu...@gmail.com>.
Hello all
I've been getting a few queries about this issue from various people
off-list, so I thought I'd reply here with some useful ideas for future
generations struggling with this issue.
My advice:
If I remember correctly, you should check your Spring XML, the ActiveMQ
schema and the schema.location in the ActiveMQ JAR *very* carefully to make
sure that all the various URIs and other IDs match up.
And be sure to read: http://erik.jteam.nl/?p=27
One person who followed this advice replied to me, saying:
You are right,i have corrected the namespace decleration in the spring xml
and it works now. But i guess i cannot use the spring property placeholders
for amq:... namespaces.It complains a lot.
Hope this helps.
Cheers,
Albert
----- Original Message -----
From: "Albert Strasheim" <fu...@gmail.com>
To: <us...@activemq.apache.org>
Sent: Friday, September 21, 2007 10:41 PM
Subject: Re: The matching wildcard is strict error with AMQ 5 (was Re: AMQ
4.1 and Spring XML beans)
> Found the bug somewhere between the chair and the keyboard.
>
> ----- Original Message -----
> From: "Albert Strasheim" <fu...@gmail.com>
> To: <us...@activemq.apache.org>
> Sent: Friday, September 21, 2007 10:16 PM
> Subject: The matching wildcard is strict error with AMQ 5 (was Re: AMQ 4.1
> and Spring XML beans)
Re: The matching wildcard is strict error with AMQ 5 (was Re: AMQ 4.1 and Spring XML beans)
Posted by Albert Strasheim <fu...@gmail.com>.
Found the bug somewhere between the chair and the keyboard.
----- Original Message -----
From: "Albert Strasheim" <fu...@gmail.com>
To: <us...@activemq.apache.org>
Sent: Friday, September 21, 2007 10:16 PM
Subject: The matching wildcard is strict error with AMQ 5 (was Re: AMQ 4.1
and Spring XML beans)
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.org/config/1.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:util="http://www.springframework.org/schema/util"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-2.0.xsd
> http://activemq.org/config/1.0
> http://activemq.apache.org/schema/core/activemq-core-5.0-SNAPSHOT.xsd">
This last URI should be
http://activemq.apache.org/snapshot-schema/activemq-core-5.0.xsd
It would appear the example at
http://activemq.apache.org/spring-support.html
is wrong, since the spring.schemas isn't set up to work with the URI listed
there (and the one I tried to use).
Thanks to Erik Wiersma for helping me figure this out.
http://erik.jteam.nl/?p=27
Cheers,
Albert
The matching wildcard is strict error with AMQ 5 (was Re: AMQ 4.1 and Spring XML beans)
Posted by Albert Strasheim <fu...@gmail.com>.
Hello all
I'm experiencing this same error with ActiveMQ 5.0 trunk revision 578254.
ERROR: Failed to instantiate Spring bean factory: Line 9 in XML document
from file [C:\gridgain-1.5.1\config\gridgain.xml] is invalid; nested excepti
on 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'.
wrapper
I'm trying to configure GridGain to use ActiveMQ. Without the amq:broker
bits, it works fine. My XML configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://activemq.org/config/1.0
http://activemq.apache.org/schema/core/activemq-core-5.0-SNAPSHOT.xsd">
<description>GridGain configuration</description>
<amq:broker useJmx="false" persistent="false">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:41292" />
</amq:transportConnectors>
</amq:broker>
<util:map id="jmsJndiMap">
<entry>
<key>
<util:constant
static-field="javax.naming.Context.INITIAL_CONTEXT_FACTORY" />
</key>
<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
</entry>
<entry>
<key>
<util:constant static-field="javax.naming.Context.PROVIDER_URL" />
</key>
<value>vm://localhost</value>
</entry>
</util:map>
<bean id="grid" class="org.gridgain.grid.GridConfigurationAdapter"
scope="singleton">
<property name="gridName" value="mygrid" />
<property name="peerClassLoadingEnabled" value="true" />
<property name="communicationSpi">
<bean
class="org.gridgain.grid.spi.communication.jms.GridJmsCommunicationSpi">
<property name="connectionFactoryName" value="connectionFactory" />
<property name="topicName" value="topic/gridgain.communication" />
<property name="jndiEnvironment" ref="jmsJndiMap" />
</bean>
</property>
<property name="discoverySpi">
<bean class="org.gridgain.grid.spi.discovery.jms.GridJmsDiscoverySpi">
<property name="connectionFactoryName" value="connectionFactory" />
<property name="topicName" value="topic/gridgain.discovery" />
<property name="jndiEnvironment" ref="jmsJndiMap" />
</bean>
</property>
</bean>
</beans>
Any thoughts?
Regards,
Albert
----- Original Message -----
From: "Paul Smith" <ps...@aconex.com>
To: <us...@activemq.apache.org>
Sent: Monday, September 03, 2007 1:06 PM
Subject: AMQ 4.1 and Spring XML beans
> Confused! This works (as expected):
>
> <amq:broker useJmx="true" persistent="true">
> <amq:persistenceAdapter>
> <amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
> </amq:persistenceAdapter>
>
> <amq:transportConnectors>
> <amq:transportConnector uri="tcp://localhost:0" />
> </amq:transportConnectors>
> </amq:broker>
>
> But this doesn't which is sort of copied from the XML guide on the
> website:
>
> <amq:broker useJmx="true" persistent="true">
> <amq:persistenceAdapter>
> <journaledJDBC journalLogFiles="5" dataDirectory="$
> {activemq.base}/activemq-data" dataSource="#derby-ds"/>
> </amq:persistenceAdapter>
>
> <amq:transportConnectors>
> <amq:transportConnector uri="tcp://localhost:0" />
> </amq:transportConnectors>
> </amq:broker>
>
> I get this error after starting up Spring:
>
> Exception in thread "main"
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: L
> ine 15 in XML document from class path resource [amq.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 'journaledJDBC'.
> 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 'journaledJDBC'.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXPar
> seException(ErrorHandlerWrapper.java:236)
Re: AMQ 4.1 and Spring XML beans
Posted by Paul Smith <ps...@aconex.com>.
On 04/09/2007, at 4:46 PM, James Strachan wrote:
> On 9/3/07, Paul Smith <ps...@aconex.com> wrote:
>> Confused! This works (as expected):
>>
>> <amq:broker useJmx="true" persistent="true">
>> <amq:persistenceAdapter>
>> <amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
>> </amq:persistenceAdapter>
>>
>> <amq:transportConnectors>
>> <amq:transportConnector uri="tcp://localhost:0" />
>> </amq:transportConnectors>
>> </amq:broker>
>>
>> But this doesn't which is sort of copied from the XML guide on the
>> website:
>>
>> <amq:broker useJmx="true" persistent="true">
>> <amq:persistenceAdapter>
>> <journaledJDBC journalLogFiles="5" dataDirectory="$
>> {activemq.base}/activemq-data" dataSource="#derby-ds"/>
>
> this is an XML error - the <journaledJDBC> must be in the same
> namespace as the rest of the ActiveMQ XML
Tried that last night too, doesn't make any difference:
[2007-09-04 16:50:55,721 INFO ][BeanDefinitionReader][main] Loading
XML bean definitions from class path resource [amq.xml]
Exception in thread "main"
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: L
ine 16 in XML document from class path resource [amq.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: cvc-complex-type.
2.4.a: Invalid content was found starting with element
'amq:journaledJDBC'. One of '{"http://activemq.org/config/
1.0":jdbcPersistenceAdapter, "http://activemq.org/config/
1.0":journalPersistenceAdapter, "http://activemq.org/config/
1.0":kahaPersistenceAdapter, "http://activemq.org/config/
1.0":memoryPersistenceAdapter, "http://activemq.org/config/
1.0":quickJournalPersistenceAdapter, "http://activemq.org/config/
1.0":rapidPersistenceAdapter, WC[##other:"http://activemq.org/config/
1.0"]}' is expected.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
Invalid content was found starting with element 'amq:journaledJDBC'.
One of '{"http://activemq.org/config/1.0":jdbcPersistenceAdapter,
"http://activemq.org/config/1.0":journalPersistenceAdapter, "http://
activemq.org/config/1.0":kahaPersistenceAdapter, "http://activemq.org/
config/1.0":memoryPersistenceAdapter, "http://activemq.org/config/
1.0":quickJournalPersistenceAdapter, "http://activemq.org/config/
1.0":rapidPersistenceAdapter, WC[##other:"http://activemq.org/config/
1.0"]}' is expected.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXPar
seException(ErrorHandlerWrapper.java:236)
using:
<!-- lets create an embedded ActiveMQ Broker -->
<amq:broker useJmx="true" persistent="true">
<!-- <amq:persistenceAdapter>
<amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
</amq:persistenceAdapter>
-->
<amq:persistenceAdapter>
<amq:journaledJDBC journalLogFiles="5" dataDirectory="$
{activemq.base}/activemq-data" dataSource="#derby-ds"/>
</amq:persistenceAdapter>
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:0" />
</amq:transportConnectors>
</amq:broker>
Any ideas?
cheers,
Paul
Re: AMQ 4.1 and Spring XML beans
Posted by James Strachan <ja...@gmail.com>.
On 9/3/07, Paul Smith <ps...@aconex.com> wrote:
> Confused! This works (as expected):
>
> <amq:broker useJmx="true" persistent="true">
> <amq:persistenceAdapter>
> <amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
> </amq:persistenceAdapter>
>
> <amq:transportConnectors>
> <amq:transportConnector uri="tcp://localhost:0" />
> </amq:transportConnectors>
> </amq:broker>
>
> But this doesn't which is sort of copied from the XML guide on the
> website:
>
> <amq:broker useJmx="true" persistent="true">
> <amq:persistenceAdapter>
> <journaledJDBC journalLogFiles="5" dataDirectory="$
> {activemq.base}/activemq-data" dataSource="#derby-ds"/>
this is an XML error - the <journaledJDBC> must be in the same
namespace as the rest of the ActiveMQ XML
--
James
-------
http://macstrac.blogspot.com/