Announcement Announcement Module
Collapse
No announcement yet.
Spring2.0-ActiveMQ -- org.xml.sax.SAXParseException: Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring2.0-ActiveMQ -- org.xml.sax.SAXParseException:

    Hi,

    I tried the Spring-Support from ActiveMQ. As written on ActiveMQ-Site I used the following conf.xml


    <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/schem...ring-beans.xsd
    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.spri ng.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.SingleCo nnectionFactory">
    <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"></ref>
    </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>



    libs I used: commons-logging.jar, spring.jar, apache-activemq-4.1-incubator.jar, xbean-spring-2.7.jar

    this is my main-Methode, just load the configuration

    public static void main(String[] args) {
    FileSystemXmlApplicationContext ac = new FileSystemXmlApplicationContext("conf/beans.xml");
    ac.registerShutdownHook();
    try {
    Thread.sleep(10000);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    System.exit(0);
    }



    then I got the following exception/output:




    15.12.2006 15:11:16 org.springframework.core.CollectionFactory <clinit>
    INFO: JDK 1.4+ collections available
    15.12.2006 15:11:16 org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from file [D:\ECLIPSE_INST\3_2_normal\projects\Spring_ActiveM Q\conf\beans.xml]
    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionSt oreException: Line 4307 in XML document from file [D:\ECLIPSE_INST\3_2_normal\projects\Spring_ActiveM Q\conf\beans.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cos-nonambig: "http://activemq.org/config/1.0":redeliveryPolicy and WC[##any] (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
    Caused by: org.xml.sax.SAXParseException: cos-nonambig: "http://activemq.org/config/1.0":redeliveryPolicy and WC[##any] (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
    at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.createSAXParseException(ErrorHandlerWrap per.java:236)
    at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.error(ErrorHandlerWrapper.java:172)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(XMLErrorReporter.java:382)
    at com.sun.org.apache.xerces.internal.impl.xs.XSConst raints.reportSchemaError(XSConstraints.java:315)
    at com.sun.org.apache.xerces.internal.impl.xs.XSConst raints.fullSchemaChecking(XSConstraints.java:463)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.handleEndElement(XMLSchemaValidator.ja va:2246)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.endElement(XMLSchemaValidator.java:814 )
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocum entScannerImpl.scanEndElement(XMLNSDocumentScanner Impl.java:719)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl$FragmentContentDispatcher.dis patch(XMLDocumentFragmentScannerImpl.java:1685)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(XMLDocumentFragm entScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(XMLParser.java:148)
    at com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse(DOMParser.java:250)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBu ilderImpl.parse(DocumentBuilderImpl.java:292)
    at org.springframework.beans.factory.xml.DefaultDocum entLoader.loadDocument(DefaultDocumentLoader.java: 77)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:405)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:357)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:334)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:126)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:142)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:168)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:79)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:94)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:292)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:89)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:74)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:65)
    at test.TestMain.main(TestMain.java:11)


    Whats wrong with this example?

    in the spring.handlers i found the following:
    http\://activemq.org/config/1.0=org.apache.xbean.spring.context.v2.XBeanNamesp aceHandler

    but I there are more version (v2a, v2b, v2c)-Packages

    Thanks for Help
Working...
X