Spring TypeConverter在Camel RouteBuilder子类上失败

时间:2013-07-11 15:06:49

标签: spring apache-camel apache-karaf apache-servicemix

尝试在karaf上安装我的组件时出现以下错误: Caused by: org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[logparserRouteBean]

我使用getTypeConverter()返回的SimpleTypeConverter将其缩小为AbstractBeanFactory中的转换错误。 enter image description here

enter image description here

鉴于PerformanceLogRoute扩展了org.apache.camel.builder.RouteBuilder,转换如何失败?

非常感谢任何解决方案的建议和想法。

更新

package no.osl.cdms.profile.routes;

import no.osl.cdms.profile.api.TimeMeasurement;
import no.osl.cdms.profile.factories.EntityFactory;
import no.osl.cdms.profile.log.TimeMeasurementEntity;
import no.osl.cdms.profile.parser.LogLineRegexParser;
import org.apache.camel.builder.RouteBuilder;

import java.util.Map;

public class PerformanceLogRoute extends RouteBuilder {

    public static final String PERFORMANCE_LOG_ROUTE_ID = "PerformanceLogRoute";
    private static final String LOG_DIRECTORY = "C:/data";
    private static final String LOG_FILE = "performance.log";
    private static final int DELAY = 0;

    private LogLineRegexParser logLineRegexParser = new LogLineRegexParser();
    private EntityFactory entityFactory = EntityFactory.getInstance();

    private static final String LOG_FILE_ENDPOINT = "stream:file?    fileName="+LOG_DIRECTORY +"/"+LOG_FILE+"&scanStream=true&scanStreamDelay=" + DELAY;
    private static final String DATABASE_ENDPOINT = "jpa:";


    @Override
    public void configure() throws Exception{
        fromF(LOG_FILE_ENDPOINT, LOG_DIRECTORY, LOG_FILE, DELAY)
            .convertBodyTo(String.class)                  // Converts input to String
            .choice().when(body().isGreaterThan(""))      // Ignores empty lines
            .bean(logLineRegexParser, "parse")            // Parses log entry into String map
            .bean(entityFactory, "createTimemeasurement") // Parses log entry into database format
            .split(body())
            .choice().when(body().isNotNull())
            .toF(DATABASE_ENDPOINT, body().getClass().toString())
            .routeId(PERFORMANCE_LOG_ROUTE_ID);
    }

    public String toString() {
        return PERFORMANCE_LOG_ROUTE_ID;
    }
}

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

    <bean id="logparserRouteBean" class="no.osl.cdms.profile.routes.PerformanceLogRoute" />
<camelContext id="cdms-core-camel-context" xmlns="http://camel.apache.org/schema/spring">
    <routeBuilder ref="logparserRouteBean" />
</camelContext>

</beans>

这就是我现在所发现的。从我记忆中它与导致错误的原因相同,但我会在早上仔细检查。

0 个答案:

没有答案