FAQ
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

Search Discussions

  • Claus Ibsen at Aug 25, 2010 at 12:12 pm
    Can you post the code of your route
    On Wed, Aug 25, 2010 at 2:07 PM, Tarjei Huse wrote:
    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


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedAug 25, '10 at 12:07p
activeAug 25, '10 at 12:12p
posts2
users2
websitecamel.apache.org

2 users in discussion

Claus Ibsen: 1 post Tarjei Huse: 1 post

People

Translate

site design / logo © 2022 Grokbase