Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Datasource not found in par deployment(Virgo doesn't find my datasource)
Datasource not found in par deployment [message #963003] Mon, 29 October 2012 13:51 Go to next message
Erik Vande Velde is currently offline Erik Vande VeldeFriend
Messages: 82
Registered: September 2012
Member
In my deployment I created a dedicated bundle with the sole purpose of providing a datasource to the other bundles. One of my services/bundles uses that datasource in its application context to configure flyway. The application context file is attached to this post. I also attached the manifest.mf of the datasource bundle. Now, when I deploy the modules one by one everything works fine. But when I deploy a par with the same bundles in it, startup fails with this message:
com.googlecode.flyway.core.exception.FlywayException: Unable to obtain Jdbc connection from DataSource. What's the difference between both types of deployment?
Re: Datasource not found in par deployment [message #963138 is a reply to message #963003] Mon, 29 October 2012 15:51 Go to previous messageGo to next message
Mastah Naleh is currently offline Mastah NalehFriend
Messages: 32
Registered: April 2012
Member
Might be the start order of each bundle ?
Just to check, try adding bundle-required on the one using the datasource bundle.

Might also be because while the bundle links each others and start trying to access DB connection, the datasource bundle is still establishing a connection.
Re: Datasource not found in par deployment [message #964055 is a reply to message #963138] Tue, 30 October 2012 08:17 Go to previous messageGo to next message
Erik Vande Velde is currently offline Erik Vande VeldeFriend
Messages: 82
Registered: September 2012
Member
I googled around and didn't find any information about a 'bundle-required' keyword in a manifest file, do you have some documentation about its usage? In blog.osgi.org/2006/04/misconceptions-about-osgi-headers.html they explain that Bundle-Required doesn't influence the starting order of bundles, it is purely related to the resolving of dependencies. I found somewhere (forum.springsource.org/archive/index.php/t-61940.html) that there really is no startup order in a par, and it seems this is my problem. When bundle B is initializing (resolving the spring context files) it needs to be sure that A is running to get to the datasource, and I'm a bit afraid that there is no way to do it in Virgo.
Re: Datasource not found in par deployment [message #964385 is a reply to message #964055] Tue, 30 October 2012 13:25 Go to previous messageGo to next message
Mastah Naleh is currently offline Mastah NalehFriend
Messages: 32
Registered: April 2012
Member
Key word : Require-Bundle (see : http://wiki.osgi.org/wiki/Require-Bundle)

As for this to be the problem, actually, I don't believe this can be the source of your problems. It might be the second reason I gave you.
Re: Datasource not found in par deployment [message #968332 is a reply to message #964385] Fri, 02 November 2012 11:31 Go to previous message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
In general, bundles should be able to cope with starting in arbitrary orders. There are various ways to achieve this. For instance, if bundle B consumed a service that bundle A published once it has finished initialising, then this would delay the Spring processing of bundle B appropriately. In fact, if bundle A is "Spring DM powered", it will publish its application context as a service which you could then use in bundle B simply to control the ordering.

If that approach isn't practical in this case, you might replace the PAR file with a scoped plan in order to control the start order of the content bundles. (You can also put a plan file inside a PAR, but that probably defeats the object as the plan file needs to refer to content in the repository rather than in the PAR file.) But you'd still be in a race, so it probably wouldn't help much.
Previous Topic:Package merge Problem
Next Topic:Strange ClassNotFoundException
Goto Forum:
  


Current Time: Sat Apr 20 03:00:39 GMT 2024

Powered by FUDForum. Page generated in 0.03459 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top