Hi, after upgrading to Camel 2.4.0 I am having a problem with some
routes that depend on Hibernate daos.

It all started with this error message:
...
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource' defined in class path
resource [applicationContext-HSQLdb.xml]: Initialization of bean failed;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'camelContext': Invocation of init method failed; nested
exception is org.apache.camel.RuntimeCamelException:
org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'sessionFactory': FactoryBean which is
currently in creation returned null from getObject
...
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'camelContext': Invocation of init method
failed; nested exception is org.apache.camel.RuntimeCamelException:
org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'sessionFactory': FactoryBean which is
currently in creation returned null from getObject..

It seems that when I define a bean with dependencies on hibernate DAOs,
then the Camelcontext also becomse dependant on the sessionFactory,
someting I find very odd.

This whole setup worked very nicely before I upgraded to Spring 3/Camel
2.4.0. I just cannot understand what has causing this. According to
google the error usually shows up when I have circular dependencies, but
in this case that does not seem to be the issue.

I have now refactored all objects so that they use setter injection, but
this doesn't help. No dice. It seems that the camelContext changes the
order that beans are created in.

Basicly, this does not create the error:
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:aop="http://www.springframework.org/schema/aop";
    xmlns:context="http://www.springframework.org/schema/context";
    xmlns:camel="http://camel.apache.org/schema/spring";
    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
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context.xsd
       ">
<bean id="IndexLookupRoute"
class="com.scanmine.router.routes.IndexLookupRoute"  />

    <camel:camelContext >
        <camel:contextScan>
            <camel:includes>*</camel:includes>
        </camel:contextScan>
</camel:camelContext>

But the route is not loaded into the camel process. While this:
    <camel:camelContext >
        <camel:routeBuilder ref="IndexLookupRoute"/>
</camel:camelContext>

Generates the error above.

Any tips?

-- 

Regards / Med vennlig hilsen
Tarjei Huse
Mobil: 920 63 413

Reply via email to