日期:2014-05-19  浏览次数:20756 次

请教activemq+spring的配置问题
在读配置文件时总是出现以下异常:
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 3 in XML document from class path resource [com/dhc/jms/activemq.xml] is invalid; nested exception is org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Drcom'.

Caused by: org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Drcom'.
环境:spring2.0,activemq 5.0
下面是出错部分,如果把<amp..>去掉就没有问题,麻烦各位帮看下哪里出的问题,谢谢
XML code

<?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/schema/beans/spring-beans.xsd
 http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd">
    <amq:broker useJmx="false" persistent="true">  
        <amq:persistenceAdapter>  
            <amq:amqPersistenceAdapter directory="d:/amq"/>  
        </amq:persistenceAdapter>  
        <amq:transportConnectors>  
            <amq:transportConnector uri="tcp://localhost:0" />  
        </amq:transportConnectors>  
    </amq:broker>  





------解决方案--------------------
配置文件上看不出什么问题。在依赖包的配置和项目的配置上再仔细查看下。

我附上我做的active5.1+spring2.5的demo。给你~~自己来参考配置

http://download.csdn.net/source/617651
------解决方案--------------------
你把amq5的META-INF里的spring.schemas
http\://activemq.apache.org/schema/activemq-core.xsd = activemq.xsd改成

http\://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd = activemq.xsd就可以了
------解决方案--------------------
http\://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd


比较支持这个

xsd文件问题