在xml中运行应用程序时遇到问题

时间:2017-04-14 07:43:22

标签: spring spring-integration

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-mongodb="http://www.springframework.org/schema/integration/mongodb"
    xmlns:mongo="http://www.springframework.org/schema/data/mongo"
    xmlns:task="http://www.springframework.org/schema/task" 
    xmlns:jms="http://www.springframework.org/schema/jms"
    xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/data/mongo 
    http://www.springframework.org/schema/data/mongo/spring-mongo.xsd 
    http://www.springframework.org/schema/integration 
    http://www.springframework.org/schema/integration/spring-integration.xsd 
    http://www.springframework.org/schema/integration/mongodb 
    http://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb.xsd
    http://www.springframework.org/schema/task
    http://www.springframework.org/schema/task/spring-task-3.0.xsd
    http://www.springframework.org/schema/integration/jms
    http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">

    <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616" />
    </bean>
    <bean id="messageDestination" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg value="messageQueue1" />
    </bean>
    <!-- spring integration beans -->
    <int:channel id="jmsMessages">
        <int:queue capacity="1000" />
    </int:channel>
    <jms:inbound-channel-adapter id="jmsMsgAdapter"
        connection-factory="connectionFactory" destination="messageDestination"
        channel="jmsMessages">
        <int:poller fixed-rate="500" />
    </jms:inbound-channel-adapter>

    <mongo:db-factory id="mongoDbFactory" dbname="DeviceTrack"
        port="27017" host="localhost" />
    <int-mongodb:outbound-channel-adapter
        channel="jmsMessages" collection-name="jmsMessage" mongodb-factory="mongoDbFactory" />

</beans>

错误:

Caused by: groovy.lang.MissingMethodException: No signature of method: static ajsc.util.AjscLogMessageService.formatExceptionDetails() is applicable for argument types: (org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException) values: [org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 30 in XML document from URL [file:D:/LucyWorkspace/ExistingDeviceFlow/target/swm/package/nix/dist_files/appl/ExistingDeviceFlow/conf/YOUR_SERVICE/v1/appMessageContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 32; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'int:channel'.]
    at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1500)
    at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1486)
    at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.callStatic(StaticMetaClassSite.java:65)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:206)
    at ajsc.util.AjscLogMessageService.logMessage(AjscLogMessageService.groovy:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    enter code here

当我使用没有弹簧集成时,每件事情都运作良好。当我与Spring集成时,我无法正确构建xml。我想我已经做到了 由于缺少xsd,一些xml解析问题。 任何人都可以帮我解决问题......

1 个答案:

答案 0 :(得分:0)

  

无法找到元素&#39; int:channel&#39;

的声明

这通常意味着你的类路径上没有spring-integration-core jar;该jar中的xsd(由/META-INF/spring.schemas映射)。