You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by elusivemel <MJ...@CNTUS.JNJ.COM> on 2006/12/06 21:13:23 UTC

Spring 2.0 + ActiveMQ 4.1 Snapshot: SAXParseException on XML config files

I've been trying to wire up ActiveMQ 4.1-SNAPSHOT with Spring 2.0-m2 with no
success.  I'm using maven2 to manage my project's build process and I'm
using xbean-spring-common 2.7:

>From my pom.xml:

    <dependency>
      <groupId>org.apache.xbean</groupId>
      <artifactId>xbean-spring-common</artifactId>
      <version>2.7</version>
    </dependency>

I started with the example spring XML configuration file
(http://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/test/resources/spring-embedded-xbean.xml)
, but got an exception:

------- begin error message ------- 

org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in
XML document from ServletContext resource
[/WEB-INF/jms-context.xml] is invalid; nested exception is
org.xml.sax.SAXParseException: Document root element "beans", must match
DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match
DOCTYPE root "null".

------- end error message ------- 


Here's a look at my spring configuration file.

------ begin jms-context.xml ------ 
<?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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/dtd/spring-beans-2.0.dtd
http://activemq.org/config/1.0
http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-incubator-SNAPSHOT.xsd">

	<!--  lets create an embedded ActiveMQ Broker -->
	<amq:broker useJmx="false" persistent="false">
		<amq:transportConnectors>
			<amq:transportConnector uri="tcp://localhost:0" />
		</amq:transportConnectors>
	</amq:broker>

	<!--  ActiveMQ destinations to use  -->
	<amq:queue id="destination"
		physicalName="org.apache.activemq.spring.Test.spring.embedded" />

	<!-- JMS ConnectionFactory to use, configuring the embedded broker using
XML -->
	<amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost" />

	<!-- 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>
			</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>
</beans>
------ end jms-context.xml ------ 


Am I missing a DTD somewhere?  The message "Document root element "beans",
must match DOCTYPE root 'null'" has me stumped.  

It's been two frustrating days and I don't see any end in sight.  Any help
would be greatly appreciated.


-- 
View this message in context: http://www.nabble.com/Spring-2.0-%2B-ActiveMQ-4.1-Snapshot%3A-SAXParseException-on-XML-config-files-tf2770420.html#a7726944
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Spring 2.0 + ActiveMQ 4.1 Snapshot: SAXParseException on XML config files

Posted by elusivemel <MJ...@CNTUS.JNJ.COM>.
Thanks for the help.  Upgrading to version 4.1.0 and pointing to the XSD file
did the trick, thanks.  I'm up and running.

So if I understand things correctly, 4.1-SNAPSHOT is *not* compatible with
spring 2.0, but 4.1.0 is?   



James.Strachan wrote:
> 
> Agreed - I'd also recommend moving to 4.1.0 (which uses spring 2.0)
> 
> On 12/7/06, pradeep <pr...@gmail.com> wrote:
>>
>> Why are you pointing to dtd in your xml file?
>>
>>   xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/dtd/spring-beans-2.0.dtd
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> Replace it with
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>
>> pradeep
>>
>>
>>
>>
>> elusivemel wrote:
>> >
>> > I've been trying to wire up ActiveMQ 4.1-SNAPSHOT with Spring 2.0-m2
>> with
>> > no success.  I'm using maven2 to manage my project's build process and
>> I'm
>> > using xbean-spring-common 2.7:
>> >
>> > From my pom.xml:
>> >
>> >     <dependency>
>> >       <groupId>org.apache.xbean</groupId>
>> >       <artifactId>xbean-spring-common</artifactId>
>> >       <version>2.7</version>
>> >     </dependency>
>> >
>> > I started with the example spring XML configuration file
>> >
>> (http://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/test/resources/spring-embedded-xbean.xml)
>> > , but got an exception:
>> >
>> > ------- begin error message -------
>> >
>> > org.springframework.beans.factory.BeanDefinitionStoreException: Line 5
>> in
>> > XML document from ServletContext resource
>> > [/WEB-INF/jms-context.xml] is invalid; nested exception is
>> > org.xml.sax.SAXParseException: Document root element "beans", must
>> match
>> > DOCTYPE root "null".
>> > org.xml.sax.SAXParseException: Document root element "beans", must
>> match
>> > DOCTYPE root "null".
>> >
>> > ------- end error message -------
>> >
>> >
>> > Here's a look at my spring configuration file.
>> >
>> > ------ begin jms-context.xml ------
>> > <?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"
>> >       xsi:schemaLocation="http://www.springframework.org/schema/beans
>> > http://www.springframework.org/dtd/spring-beans-2.0.dtd
>> > http://activemq.org/config/1.0
>> >
>> http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-incubator-SNAPSHOT.xsd">
>> >
>> >       <!--  lets create an embedded ActiveMQ Broker -->
>> >       <amq:broker useJmx="false" persistent="false">
>> >               <amq:transportConnectors>
>> >                       <amq:transportConnector uri="tcp://localhost:0"
>> />
>> >               </amq:transportConnectors>
>> >       </amq:broker>
>> >
>> >       <!--  ActiveMQ destinations to use  -->
>> >       <amq:queue id="destination"
>> >              
>> physicalName="org.apache.activemq.spring.Test.spring.embedded" />
>> >
>> >       <!-- JMS ConnectionFactory to use, configuring the embedded
>> broker using
>> > XML -->
>> >       <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"
>> />
>> >
>> >       <!-- 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>
>> >                       </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>
>> > </beans>
>> > ------ end jms-context.xml ------
>> >
>> >
>> > Am I missing a DTD somewhere?  The message "Document root element
>> "beans",
>> > must match DOCTYPE root 'null'" has me stumped.
>> >
>> > It's been two frustrating days and I don't see any end in sight.  Any
>> help
>> > would be greatly appreciated.
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Spring-2.0-%2B-ActiveMQ-4.1-Snapshot%3A-SAXParseException-on-XML-config-files-tf2770420.html#a7734118
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-2.0-%2B-ActiveMQ-4.1-Snapshot%3A-SAXParseException-on-XML-config-files-tf2770420.html#a7800460
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Spring 2.0 + ActiveMQ 4.1 Snapshot: SAXParseException on XML config files

Posted by James Strachan <ja...@gmail.com>.
Agreed - I'd also recommend moving to 4.1.0 (which uses spring 2.0)

On 12/7/06, pradeep <pr...@gmail.com> wrote:
>
> Why are you pointing to dtd in your xml file?
>
>   xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/dtd/spring-beans-2.0.dtd
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Replace it with http://www.springframework.org/schema/beans/spring-beans.xsd
>
> pradeep
>
>
>
>
> elusivemel wrote:
> >
> > I've been trying to wire up ActiveMQ 4.1-SNAPSHOT with Spring 2.0-m2 with
> > no success.  I'm using maven2 to manage my project's build process and I'm
> > using xbean-spring-common 2.7:
> >
> > From my pom.xml:
> >
> >     <dependency>
> >       <groupId>org.apache.xbean</groupId>
> >       <artifactId>xbean-spring-common</artifactId>
> >       <version>2.7</version>
> >     </dependency>
> >
> > I started with the example spring XML configuration file
> > (http://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/test/resources/spring-embedded-xbean.xml)
> > , but got an exception:
> >
> > ------- begin error message -------
> >
> > org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in
> > XML document from ServletContext resource
> > [/WEB-INF/jms-context.xml] is invalid; nested exception is
> > org.xml.sax.SAXParseException: Document root element "beans", must match
> > DOCTYPE root "null".
> > org.xml.sax.SAXParseException: Document root element "beans", must match
> > DOCTYPE root "null".
> >
> > ------- end error message -------
> >
> >
> > Here's a look at my spring configuration file.
> >
> > ------ begin jms-context.xml ------
> > <?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"
> >       xsi:schemaLocation="http://www.springframework.org/schema/beans
> > http://www.springframework.org/dtd/spring-beans-2.0.dtd
> > http://activemq.org/config/1.0
> > http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-incubator-SNAPSHOT.xsd">
> >
> >       <!--  lets create an embedded ActiveMQ Broker -->
> >       <amq:broker useJmx="false" persistent="false">
> >               <amq:transportConnectors>
> >                       <amq:transportConnector uri="tcp://localhost:0" />
> >               </amq:transportConnectors>
> >       </amq:broker>
> >
> >       <!--  ActiveMQ destinations to use  -->
> >       <amq:queue id="destination"
> >               physicalName="org.apache.activemq.spring.Test.spring.embedded" />
> >
> >       <!-- JMS ConnectionFactory to use, configuring the embedded broker using
> > XML -->
> >       <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost" />
> >
> >       <!-- 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>
> >                       </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>
> > </beans>
> > ------ end jms-context.xml ------
> >
> >
> > Am I missing a DTD somewhere?  The message "Document root element "beans",
> > must match DOCTYPE root 'null'" has me stumped.
> >
> > It's been two frustrating days and I don't see any end in sight.  Any help
> > would be greatly appreciated.
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Spring-2.0-%2B-ActiveMQ-4.1-Snapshot%3A-SAXParseException-on-XML-config-files-tf2770420.html#a7734118
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Spring 2.0 + ActiveMQ 4.1 Snapshot: SAXParseException on XML config files

Posted by pradeep <pr...@gmail.com>.
Why are you pointing to dtd in your xml file?

  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/dtd/spring-beans-2.0.dtd 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Replace it with http://www.springframework.org/schema/beans/spring-beans.xsd

pradeep




elusivemel wrote:
> 
> I've been trying to wire up ActiveMQ 4.1-SNAPSHOT with Spring 2.0-m2 with
> no success.  I'm using maven2 to manage my project's build process and I'm
> using xbean-spring-common 2.7:
> 
> From my pom.xml:
> 
>     <dependency>
>       <groupId>org.apache.xbean</groupId>
>       <artifactId>xbean-spring-common</artifactId>
>       <version>2.7</version>
>     </dependency>
> 
> I started with the example spring XML configuration file
> (http://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/test/resources/spring-embedded-xbean.xml)
> , but got an exception:
> 
> ------- begin error message ------- 
> 
> org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in
> XML document from ServletContext resource
> [/WEB-INF/jms-context.xml] is invalid; nested exception is
> org.xml.sax.SAXParseException: Document root element "beans", must match
> DOCTYPE root "null".
> org.xml.sax.SAXParseException: Document root element "beans", must match
> DOCTYPE root "null".
> 
> ------- end error message ------- 
> 
> 
> Here's a look at my spring configuration file.
> 
> ------ begin jms-context.xml ------ 
> <?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"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/dtd/spring-beans-2.0.dtd
> http://activemq.org/config/1.0
> http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-incubator-SNAPSHOT.xsd">
> 
> 	<!--  lets create an embedded ActiveMQ Broker -->
> 	<amq:broker useJmx="false" persistent="false">
> 		<amq:transportConnectors>
> 			<amq:transportConnector uri="tcp://localhost:0" />
> 		</amq:transportConnectors>
> 	</amq:broker>
> 
> 	<!--  ActiveMQ destinations to use  -->
> 	<amq:queue id="destination"
> 		physicalName="org.apache.activemq.spring.Test.spring.embedded" />
> 
> 	<!-- JMS ConnectionFactory to use, configuring the embedded broker using
> XML -->
> 	<amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost" />
> 
> 	<!-- 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>
> 			</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>
> </beans>
> ------ end jms-context.xml ------ 
> 
> 
> Am I missing a DTD somewhere?  The message "Document root element "beans",
> must match DOCTYPE root 'null'" has me stumped.  
> 
> It's been two frustrating days and I don't see any end in sight.  Any help
> would be greatly appreciated.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-2.0-%2B-ActiveMQ-4.1-Snapshot%3A-SAXParseException-on-XML-config-files-tf2770420.html#a7734118
Sent from the ActiveMQ - User mailing list archive at Nabble.com.