Java 加载spring驼峰上下文时出错(类型不匹配)
我正在一个小项目上使用FuseIDE(Eclipse),该项目有一个SpringCamel上下文、一个路由和一个测试。我添加了一个额外的xml来定义测试执行环境 当我运行测试时,由于类型不匹配,加载上下文bean信息失败(当实例化bean上下文的PropertyDescriptor类时,setter类型为org.apache.camel.spring.SpringCamelContext,getter类型为org.apache.camel.model.ModelCamelContext 最初的异常是:“java.beans.IntrospectionException:读写方法之间的类型不匹配” 测试代码如下:Java 加载spring驼峰上下文时出错(类型不匹配),java,spring,apache-camel,apache-servicemix,Java,Spring,Apache Camel,Apache Servicemix,我正在一个小项目上使用FuseIDE(Eclipse),该项目有一个SpringCamel上下文、一个路由和一个测试。我添加了一个额外的xml来定义测试执行环境 当我运行测试时,由于类型不匹配,加载上下文bean信息失败(当实例化bean上下文的PropertyDescriptor类时,setter类型为org.apache.camel.spring.SpringCamelContext,getter类型为org.apache.camel.model.ModelCamelContext 最初的异
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>
com.test.fuse.routes
路由代码为空,它仅扩展RouteBuilder并重写configure方法
我在ubuntu上使用OpenJDK1.6.024
如果你还需要什么,请询问
谢谢我刚刚清理了工作区,在pom.xml上将我的spring版本从2.5.4改为2.5.6,一切正常 感谢克劳德·易卜生和巴巴克·瓦达特的帮助