Gemini JPA messes around with OSGI startup sequence [message #1046763] |
Mon, 22 April 2013 06:37  |
Eclipse User |
|
|
|
I have an RCP application that is configured with the following bundles:
-bundle RCP: is an Application that references services registered by bundle SERVICES. It holds dependencies to both SERVICES and PERSISTENCE
-bundle SERVICES: defines blueprint services and references a MANDATORY persistency service, bundle PERSISTENCE. It holds dependencies to PERSISTENCE.
-bundle PERSISTENCE: registers a gemini blueprint JPA service
Sometimes it works (which leads me to believe that the configurations in themselves are ok), but it seems very vulnerable to the applied startup sequence.
What I have found out is the following. Whenever I activate org.eclipse.gemini.jpa, it seems to do something with all the bundles in my runtime configuration. As a result, the RCP often can't startup (application id not found), which are caused by a number of exceptions:
java.lang.IllegalStateException: BundleContext is no longer valid
I THINK that the following happens:
- RCP starts up and begins to do it's thing
- org.eclipse.gemini.jpa starts up and interferes with the Application startup by stopping the relevant bundles, presumably SERVICES. A moment later SERVICES is restarted as DS takes over.
When the startup sequence is completed, and I run 'ss' in the console, everything seems fine (except for the afore mentioned exceptions). Obviously there are no startup problems when I do not activate org-eclipse.gemini.jpa (but with imaginable results...)
When I change the reference to the persistence service in SERVICES to optional, everything starts up without problems, but the services in bundle SERVICES will not have a connection to the database.
I am thinking of combining the SERVICES and PERSISTENCE bundles, which will reduce the number of steps between
RCP -> SERVICES ->PERSISTENCE -> Database (MySql)
but before doing so I would like advice from the community...I don't think the approach is that exotic, and there is still a vulnerability between the JPA startup and an RCP application startup.
Am I dealing with a JPA bug here, a runtime configuration issue, or is something else happening.
Thanks
|
|
|
|
|
Re: Gemini JPA messes around with OSGI startup sequence [message #1051922 is a reply to message #1047009] |
Mon, 29 April 2013 07:26  |
Eclipse User |
|
|
|
Mike,
Thanks for the reply. Yes, the problem was introduced because I am currently engaged in a refactoring activity (to genmini blueprint), which created the dependency jumble. I have posted the my findings in
http://www.eclipse.org/forums/index.php/m/1051264/#msg_1051264
But As far as I can tell, the best ways to prevent these problems from occurring is to
- create a common bundle which holds all the interfaces and common classes
- decouple the persistence bundle (and dependent bundles) from the RCP
- make the connection between the persistence bundle and RCP through services, with (at best) dependencies with the common bundle
- Expect a situation that some services are not ready yet when the RCP views are started.
This refactoring approach seems to do the trick.
|
|
|
Powered by
FUDForum. Page generated in 0.03575 seconds