加载camelcontext时,嵌套异常为java.lang.reflect.MalformedParameterizedTypeException

时间:2018-07-12 07:22:51

标签: java spring apache-camel

*我的主类调用该类来加载骆驼xml文件。 *

public void routeCaller() {
        try {
            ApplicationContext appContext = null;
            System.out.println("HI......");
            try {
                appContext = new ClassPathXmlApplicationContext(
                        "classpath:/META-INF/spring/camel-context.xml");
                SpringCamelContext camel = (SpringCamelContext) appContext
                        .getBean("camel-context");
                System.out.println("Successfully loaded..............");
                camel.startAllRoutes();

                ProducerTemplate producerTemplate = camel
                        .createProducerTemplate();
                Object response =  producerTemplate.requestBody("direct:updateEdiProvStatusToErrored",
                        new Object());
            } catch (Exception e) {
                System.out.println("handled" + e);
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

骆驼语境:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:osgi="http://www.springframework.org/schema/osgi"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:batch="http://www.springframework.org/schema/batch"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
        http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
        http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
    <bean id="ediProcessor"
        class="diBatchProcessor" />
    <camel:camelContext id="camel-context" >

         <camel:route id="new-route">
            <camel:from uri="direct:updateEdiProvStatusToErrored" />
            <camel:to uri="bean:ediProcessor?method=printIt" />
        </camel:route>
    </camel:camelContext>
</beans>

项目有很多依赖关系,并且使用maven-assembly插件捆绑到jar中。最初加载骆驼上下文文件时出现以下错误

org.springframework.beans.factory.BeanCreationException:创建名称为'camel-context'的bean时出错:初始化bean失败;嵌套的异常是java.lang.reflect.MalformedParameterizedTypeException org.springframework.beans.factory.BeanCreationException:创建名称为'camel-context'的bean时出错:初始化bean失败;嵌套异常为java.lang.reflect.MalformedParameterizedTypeException

0 个答案:

没有答案