ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

java – 加载spring camel context(类型不匹配)时出错

2019-07-09 15:18:47  阅读:302  来源: 互联网

标签:java spring apache-camel apache-servicemix


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

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

最初的异常是:“java.beans.IntrospectionException:读取和写入方法之间的类型不匹配”

测试代码是这样的:

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.

如果你需要别的东西请问.

谢谢

解决方法:

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

感谢Claud Ibsen和Babak Vahdat的帮助.

标签:java,spring,apache-camel,apache-servicemix
来源: https://codeday.me/bug/20190709/1413999.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有