处理xml时出现spring context错误

时间:2014-03-24 13:35:55

标签: spring apache-camel

我在使用非常简单的内容处理root-context时遇到问题。我只想配置camel-clientcamel proxy bean,但我得到:

  

处理XML'提供程序时出错   com.sun.xml.internal.bind.v2.ContextFactory无法实例化:   com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:1   IllegalAnnotationExceptions类的计数有两个属性   同名“输出”这个问题与以下内容有关   location:at public java.util.List
  org.apache.camel.model.ResequenceDefinition.getOutputs()at   org.apache.camel.model.ResequenceDefinition与此问题有关   以下位置:私有java.util.List
  org.apache.camel.model.ResequenceDefinition.outputs at   org.apache.camel.model.ResequenceDefinition'。请参阅错误日志以获取更多   细节

这是我的root-context.xml

<?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:tx="http://www.springframework.org/schema/tx"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <!-- Root Context: defines shared resources visible to all other web components -->

    <camel:camelContext id="camel-client">

    </camel:camelContext>


    <!-- Camel proxy for a given service, in this case the JMS queue -->
    <camel:proxy
        id="serviceProxy"
        camelContextId="camel-client"
        serviceInterface="pl.test.Service"
        serviceUrl="jms:queue:test?transferException=true"/>


    <bean id="jboss" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="connectionFactory"/>
    </bean>

    <jee:jndi-lookup id="connectionFactory" jndi-name="QueueConnectionFactory">

    </jee:jndi-lookup>

</beans>

我的camel中有pom.xml个依赖项。任何人都可以给我一个暗示我在做错的地方?

1 个答案:

答案 0 :(得分:1)

根据Camel代理documentation <camel:proxy>必须在<camel:camelContext>内:

<camel:camelContext id="camel-client">
    <camel:proxy
        id="serviceProxy"
        camelContextId="camel-client"
        serviceInterface="pl.test.Service"
        serviceUrl="jms:queue:test?transferException=true"/>
</camel:camelContext>