0

In an attempt to install my component on karaf I get the following error: Caused by: org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[logparserRouteBean]

I've narrowed it down to a conversion error in AbstractBeanFactory using the SimpleTypeConverter as returned by the getTypeConverter(). enter image description here

enter image description here

Given that PerformanceLogRoute extends org.apache.camel.builder.RouteBuilder, how can the convertion fail??

Suggestions, and ideas to any solution is greatly appreciated.

UPDATE

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;
    }
}

The 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>

This is what I found at this moment. From what I remember it is identical to what caused the error, but I'll double check in the morning.

рüффп
  • 5,172
  • 34
  • 67
  • 113
atomman
  • 2,510
  • 1
  • 16
  • 27
  • Hi, could you post your code too please? – AlanFoster Jul 11 '13 at 20:57
  • The routing class or the camel xml? – atomman Jul 11 '13 at 21:08
  • Everything please, that would help greatly :) – AlanFoster Jul 11 '13 at 21:09
  • I'll see what I can get my hands on from this computer. :) – atomman Jul 11 '13 at 21:14
  • 1
    Try with another route builder that is very simple and dont have code that initializes etc just a simple camel route in the configure method. – Claus Ibsen Jul 12 '13 at 09:22
  • And does it work from an unit test / eg plain java. As you have tagged this with Karaf / SMX you may run in OSGi and then shit can happend – Claus Ibsen Jul 12 '13 at 09:22
  • @ClausIbsen I changed the route to `fromF(LOG_FILE_ENDPOINT).bean(this, "print");` and added a print method to the class. Still got the same error when deploying to karaf. The unit tests also work, and is done by extending `CamelSpringTestSupport` – atomman Jul 12 '13 at 11:27
  • Could this an issue related to dependency versions on the osgi container? I've tried a simple test of the SimpleTypeConverter and everything seems to work fine during test. So is it possible that there are several 'different' versions of RouteBuilder in play here? – atomman Jul 12 '13 at 11:34

0 Answers0