Hi Frank, If I understand it correctly, you have multiple bundles where some are camel routes and 1 of them is a proxy bundle, right?
If so, you can make a Karaf feature and use start-levels. So your proxy-bundle that is required can startup prior to the others, so it will be initialized when the other startup. But in all cases don't revert to Spring-DM. Regards, Morgan 2016-05-11 9:35 GMT+02:00 frankjoppe <[email protected]>: > Hi, > > We have an application, and upgraded from smx4.5.3 to smx6.1.0. We also > upgraded from dbcp to dbcp2 and pool2. One thing I noticed after this > upgrade, was that bundle start-up and shutdown was very, very slow. So I > looked around with Google and found that Spring-DM is deprecated and will > be > replaced with Blueprint. I also replaced Spring-DM to Blueprint for all the > bundles, and now they are much faster in start-up and shutdown. > > However Blueprint has some differences. For example, We've made Camel > routebuilders and in the configre() method, we get some configuration from > the Database. Or we have beans with a set-ter, which we give the database > connection, and we also do some init-from-the-DB in this setter method. > > We get exceptions. The MySql Drive class cannot be found. The bean using > the > DB connection (ie the configure() method in our Camel route) gets some > "proxy", while the other side of the proxy has not been initialized yet. So > packages fail when SMX starts. And if you manually restart the bundle, it > works. > > My analysis is that the DB call is done too early and that not everything > has been initialized yet. > > How to solve this? > > The DB connection is initialized in a blueprint xml, and added to jdni. > > What I already tried is: > * The bundle blueprint has a "<reference " to the DB connection, and I used > a reference-listener - sometimes works, sometimes not; > * Added a dependency in "import-packages" in the pom.xml, on pool2, under > the maven-bundle-plugin section, coincidently found this, I've seen good > results but not sure if it is 100% waterproof; > * Everywhere when possible, used lazy-inits, this works 100% but cannot be > applied for the Camel Routebuilder configure() method (I don't know when > this is called); > > Things I did not try are: > * Put configuration in local files - for this release unfeasible, for > future > an option; > * Revert to Spring-DM, I still consider this as an option, but I have seen > its behavior in my machine only, and I don't know if it has the same > problems as Blueprint, still an option.. but Blueprint has my preference. > > Please Help > > > > -- > View this message in context: > http://servicemix.396122.n5.nabble.com/Issues-with-data-access-at-bundle-initialization-time-tp5723674.html > Sent from the ServiceMix - User mailing list archive at Nabble.com. >
