null DataSource bean with Oracle in Camel Blueprint
I have a simple Camel script that creates a datasource bean and then uses it with the JDBC component. I'm using JBoss Fuse 6.3.0 Karaf.
SELECT 1 from my_table where rownum = 1
More often than not, when the script is deployed, myDataSource ends up being "null".
I've tried various tricks to see what's going on such as:
println "myDataSource = " + camelContext.registry.lookup("myDataSource")
And I get an error that "myDataSource" is not in the registry - when it is null; on the times the data source is actually created, the object's address gets printed.
The behavior is entirely inconsistent. I just undeploy and redeploy the XML over and over and eventually the datasource has a value and things work.
I've even tried creating a data source in a Groovy block and I always seem to get one.
Is there a better, more stable & reliable, way to create the datasource? Is there a way to recover from the datasource not being initialized (e.g. Do a null check and add it to the registry if needed)?
Responses