For spring you must include the XSD declaration at the top. See the
Spring 2 example here

http://activemq.apache.org/spring-support.html

On 07/11/2007, stuarthardy <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm having some major problems with configuring an embedded Broker through
> Spring. I'm following the example given on the site and I'm having problems
> getting Spring to instantiate using the XSD Schemas, I've tried this without
> the AMQ config and it loads OK so sems to be a conflict between Spring and
> AMQ.
>
> I have the following spring beans file:
>
> ========================================================
>
> <?xml version="1.0" encoding="UTF-8"?>
>
>
> <beans xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";
> xmlns="http://www.springframework.org/schema/beans";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>
>         <!--  lets create an embedded ActiveMQ Broker -->
>         <amq:broker useJmx="false" persistent="true" brokerName="localhost">
>                 <amq:transportConnectors>
>                         <amq:transportConnector name="openwire" 
> uri="tcp://localhost:61616" />
>                 </amq:transportConnectors>
>         </amq:broker>
>
>         <!--  ActiveMQ destinations to use  -->
>         <amq:topic id="destination"
>                 physicalName="transaction-match-topic" />
>     <amq:queue id="destination2" physicalName="transaction-match-queue"/>
>
>         <!-- JMS ConnectionFactory to use, configuring the embedded broker 
> using
> XML -->
>         <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost" />
>
>     <amq:persistenceAdapter>
>         <amq:jdbcPersistenceAdapter dataSource="#oracle-ds" />
>     </amq:persistenceAdapter>
>
>     <bean id="oracle-ds"
>         class="org.springframework.jndi.JndiObjectFactoryBean">
>         <property name="jndiName">
>             <value>jdbc/OracleJmsDS</value>
>         </property>
>     </bean>
>
>         <!-- Spring JMS Template -->
>         <bean id="myJmsTemplate"
>                 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>
>                                 <property name="reconnectOnException" 
> value="true"></property>
>                         </bean>
>                 </property>
>         </bean>
>
>         <bean id="consumerJmsTemplate"
>                 class="org.springframework.jms.core.JmsTemplate">
>                 <property name="connectionFactory" ref="jmsFactory" />
>         </bean>
>
>         <!-- a sample POJO which uses a Spring JmsTemplate -->
>         <bean id="producer"
>                 class="org.apache.activemq.spring.SpringProducer">
>                 <property name="template">
>                         <ref bean="myJmsTemplate" />
>                 </property>
>
>                 <property name="destination">
>                         <ref bean="destination" />
>                 </property>
>
>                 <property name="messageCount">
>                         <value>10</value>
>                 </property>
>         </bean>
>
>         <!-- a sample POJO consumer -->
>         <bean id="consumer"
>                 class="org.apache.activemq.spring.SpringConsumer">
>                 <property name="template" ref="consumerJmsTemplate" />
>                 <property name="destination" ref="destination" />
>         </bean>
>
>
>     <bean id="testService"
>
> class="com.msilm.msip.business.service.messaging.lloyds.jmsqueue.JmsSubmitGateway">
>         <property name="jmsTemplate">
>             <ref local="myJmsTemplate" />
>         </property>
>     </bean>
> </beans>
>
>
> The problem I'm having is:
> 07/11/07 11:30:43 Caused by:
> org.springframework.beans.factory.BeanDefinitionStoreException: Line 7 in
> XML document from class path resource [spring/msip-messaging-appcontext.xml]
> is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1:
> Cannot find the declaration of element 'beans'.
>
> 07/11/07 11:30:43 Caused by: org.xml.sax.SAXParseException: cvc-elt.1:
> Cannot find the declaration of element 'beans'.
>
> 07/11/07 11:30:43       at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
>
> 07/11/07 11:30:43       at
> org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
>
> 07/11/07 11:30:43       at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>
> 07/11/07 11:30:43       at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>
> 07/11/07 11:30:43       at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> Source)
>
> 07/11/07 11:30:43       at
> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
>
> ===============================================================
>
> I've looked around and found that this usually relates to a Spring 1.x jar
> in the classpath somewhere, but this is the issue.
>
> If anyone can help here it'd be hugely appreciated! as I'm close to having
> to go back to Oracle AQ (which is a pretty terrible alternative)
>
> Thanks,
> Stuart
>
> --
> View this message in context: 
> http://www.nabble.com/XSD-Validation-issues-with-Spring-and-embedded-ActiveMQ-tf4764289s2354.html#a13625878
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Reply via email to