|Gemini DBAccess and Eclipse RCP [message #1051245]
||Sun, 28 April 2013 12:59
| Kees Pieters
Registered: July 2009
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
java.lang.RuntimeException: Application "org.myapp.rcp.application"
could not be found in the registry. The applications available are:
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
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
Powered by FUDForum
. Page generated in 0.02676 seconds