You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tarjei Huse <ta...@scanmine.com> on 2010/08/25 14:07:00 UTC
camelContext depending on dataSource
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
Re: camelContext depending on dataSource
Posted by Claus Ibsen <cl...@gmail.com>.
Can you post the code of your route
On Wed, Aug 25, 2010 at 2:07 PM, Tarjei Huse <ta...@scanmine.com> 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