【问题标题】:Error loading spring camel context (type mismatch)加载弹簧骆驼上下文时出错(类型不匹配)
【发布时间】:2018-09-28 06:02:53
【问题描述】:

我在一个小项目中使用 Fuse IDE (Eclipse),它有一个 spring camel 上下文、一个路由和一个测试。我放了一个额外的xml来定义测试执行环境。

当我运行测试时,由于类型不匹配加载上下文 bean 信息而失败(当实例化 bean 上下文的 PropertyDescriptor 类时,setter 类型是 org.apache.camel.spring.SpringCamelContext 并且 getter 类型是 org.apache.camel .model.ModelCamelContext...

原来的异常是:“java.beans.IntrospectionException: type mismatch between read and write methods”

测试代码是这样的:

public class TestDBRoute extends CamelSpringTestSupport {   

@DirtiesContext //reload context
@Test
public void testPoll() throws Exception {
    //context.start();
    System.out.println("comenzo");
    Thread.sleep(1000);
    System.out.println("termino");
    //context.stop();
    assertEquals("first", 1, 1);
}

@Override
protected AbstractApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("classpath:/com/test-camel-context.xml");
}
}

骆驼上下文代码为:

<beans xmlns="http://www.springframework.org/schema/beans"
   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://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<camelContext xmlns="http://camel.apache.org/schema/spring">
        <packageScan>
            <package>com.test.fuse.routes</package>
        </packageScan>
</camelContext>
</beans>

路由代码为空,只是扩展了RouteBuilder,覆盖了configure方法。

我在 ubuntu 上使用 OpenJDK 1.6.0_24。

如果您需要其他东西,请询问。

谢谢

【问题讨论】:

    标签: java spring apache-camel apache-servicemix


    【解决方案1】:

    我刚刚清理了工作区,并将 pom.xml 上的 spring 版本从 2.5.4 更改为 2.5.6,一切正常。

    感谢 Claud Ibsen 和 Babak Vahdat 的帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-21
      • 1970-01-01
      • 2020-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多