Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Gemini DBAccess and Eclipse RCP(Something to keep in mind when using Gemini DBAccess)
Gemini DBAccess and Eclipse RCP [message #1051245] Sun, 28 April 2013 12:59 Go to next message
Kees Pieters is currently offline Kees PietersFriend
Messages: 24
Registered: July 2009
Junior Member
It's not really a bug, but it can keep you looking for considerable time, so I thought I'd share this little pitfall with the community.

What happens? well, in Eclipse, if you make a JPA persistency unit org.myapp.myjpa, and you want to use this in an RCP application in org.myapp.rcp then you may get the following Runtime error:

!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "org.myapp.rcp.application"
could not be found in the registry. The applications available are:
org.eclipse.equinox.app.error, org.eclipse.ant.core.antRunner,
org.eclipse.e4.ui.workbench.swt.E4Application,
...

The same may happen when you have another bundle that holds a mandatory reference to org.myapp.myjpa, which is imported by org.myapp.rcp. This error will not always happen (in my experience), but you will see that the startup sequence is very fragile. Another exception you may encounter is:

SEVERE: Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=org.myapp.mybundle, config=[url]bundleentry:...)
java.lang.IllegalStateException: BundleContext is no longer valid
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextIm
...

What's happening here is that the osgi framework starts up and wants to make the RCP application by loading all the dependencies. however, the persistency bundles are managed by the gemini blueprint extender, which causes the whole startup sequence to become problematic. you may also get some exceptions that bundle states are invalid (could not reproduce this for the stack trace). I ran into this problem when I had to refactor an existing application to work with gemini blueprint/JPA/DBaccess

If you want to use gemini dbAccess in an RCP, then the best approach is to prevent ANY dependencies to occur between org.myapp.rcp and the classes that manage the persistency. This means that the objects that are to be shared should be mediated through a separate bundle, which holds all the interface definitions that both org.myapp.rcp and org.myapp.myjpa use. You will also have to tackle the problem that persistency may not be available for the RCP yet, after the application becomes visible, for instacne when you want to pupulate a view.

This way, the regular startup sequence of an Eclipse application is not compromised by the activation of the blueprint bundles.

[Updated on: Mon, 29 April 2013 12:15]

Report message to a moderator

Re: Gemini DBAccess and Eclipse RCP [message #1051264 is a reply to message #1051245] Sun, 28 April 2013 13:36 Go to previous message
Kees Pieters is currently offline Kees PietersFriend
Messages: 24
Registered: July 2009
Junior Member
This tip is basically the result of my leatrning experience recorded in two other posts:

http://www.eclipse.org/forums/index.php/m/1046763/#msg_1046763
http://www.eclipse.org/forums/index.php/m/1038003/#msg_1038003

Maybe I should have included them there. sorry for that

Kees
Previous Topic:Gemini Web 2.2.2 RELEASE is now available
Next Topic:Gemini JPA messes around with OSGI startup sequence
Goto Forum:
  


Current Time: Thu Apr 25 01:02:05 GMT 2024

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

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

Back to the top