Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Gemini JPA/dbaccess and Eclipse RCP Features (Sample)
Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #650584] Tue, 25 January 2011 15:54 Go to next message
Nepomuk Seiler is currently offline Nepomuk SeilerFriend
Messages: 88
Registered: December 2010
Member
Hello,

I started to create a sample configuration based on org.eclipse.gemini.jpa.samples for an Eclipse RCP product based on features.

Currently it's only the Eclipse Sample View and all necessary bundles on auto-start. However the connection works.

You can check out the sample on:
https://svn.cip.ifi.lmu.de/~seilern/svn/org.eclipse.gemini.jpa

Greetings,
Muki

[Updated on: Tue, 25 January 2011 19:58]

Report message to a moderator

Re: Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #650615 is a reply to message #650584] Tue, 25 January 2011 17:30 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 243
Registered: July 2009
Senior Member
Thanks a lot for doing and sharing this, Muki.

BTW, the link above has an erroneous space in it. The corrected link would be:

https://svn.cip.ifi.lmu.de/~seilern/svn/org.eclipse.gemini.jpa

-Mike
Application vs. Product [message #651108 is a reply to message #650584] Thu, 27 January 2011 19:19 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk SeilerFriend
Messages: 88
Registered: December 2010
Member
Hi,
I discovered some strange behaviour with Eclipse RCP and EclipseLink Gemini JPA.

A "Eclipse Application" launch configuration with the parameter "Programm to launch" set to "Run an
application" works perfectly if gemini.jpa is set to auto-start.

Otherwise if "Programm to launch" is set to "Run a product" I get really strange errors.

With auto-start of gemini.jpa
http://dl.dropbox.com/u/2654300/stacktrace_autostart.txt
Sometimes the application is running afterwards, sometimes not.

Without auto-start (start manually via the OSGi-Console)
http://dl.dropbox.com/u/2654300/stacktrace_manualstart.txt
The application always crashes completly

[Update]
Even with "Run an application" it get those errors sometimes. I has to be the way
the bundles are started.

Eclipse.registry seems to have some problems.

Greetings,
Muki

[Updated on: Thu, 27 January 2011 21:21]

Report message to a moderator

Re: Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #651255 is a reply to message #650584] Fri, 28 January 2011 15:13 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk SeilerFriend
Messages: 88
Registered: December 2010
Member
Hi,

I've found an unsatisfying workaround.

org.eclipse.gemini.dbaccess.derby - Startlevel 2 - autostart true
org.eclipse.gemini.jpa - Startlevel 3 - autostart true

Actually I don't know why I have to start dbaccess before jpa so
the DataSourceFactory is registered properly. Furthermore I
discovered that without the workaround it seems the bundles
got loaded twice.

-Muki
Re: Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #651307 is a reply to message #651255] Fri, 28 January 2011 20:37 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 243
Registered: July 2009
Senior Member
Hi Muki,

What do you mean the bundles are loaded twice? Loaded into the framework or looked at by Gemini?

If the JDBC bundle is not activated before the JPA bundle then in theory the EMFBuilder should be registered, and then later if the builder has not been used in the interim then when the data source comes along the EMF service should be created.

We haven't tried to run this on RCP yet so I don't know what issues might surface. Any insights that you have from your experiences would be helpful.

Thanks,
-Mike
Re: Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #651322 is a reply to message #650584] Sat, 29 January 2011 01:57 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk SeilerFriend
Messages: 88
Registered: December 2010
Member
Hi,

I've been looking through Gemini's Source Code and tested a few configurations
and got some ideas what could be going wrong. Please correct if I got something
wrong reading the code despite your good documentation.

1. Gemini JPA tries to create EntityManagerFactories for all Meta-Persistence headers
it can find. If the required driver (DataSourceFactory) isn't available and active you get
a warning "DataSourceFactory for org.apache.derby.jdbc.EmbeddedDriver not registered"
When I start the bundle afterwards, Gemini JPA doesn't recognize it and isn't able to

2. I found out how to run the system 100% correctly. However it requires start-leves
and auto-start. The org.gemini.jpa and the org.gemini.dbaccess bundle MUST
start before all other not OSGi Platform relevant bundles (e.g. org.eclipse.osgi, org.eclipse.equinox.common
or org.eclipse.equinox.ds). Don't giving a startup level results in a lot of "bundle not resolved errors"
for my created plugins. Afterwards they could be resolved, but without Extension Points.
However this behaviour only occures repoducable in my complex enterprise application.
The sample I created works fine. However there could be
a different startup order which doesn't create this error.


It's really bizarre, I get a lot of different errors. I'm trying to store the stacktraces and configurations.
There will soon be a summary.

For own testing you can check out the sample repository. There are already two product-configurations for featues or plugins.

-Muki
Re: Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #651407 is a reply to message #650584] Sun, 30 January 2011 15:00 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk SeilerFriend
Messages: 88
Registered: December 2010
Member
I found the method creating the startup problems for a RCP Application:

Class: org.eclipse.gemini.jpa.PersistenceBundleExtender
Method:
    /**
     * Look for persistence unit bundles that are already installed. 
     */
    public void lookForExistingBundles() {
        
        // Look at the bundles that are already installed
        Bundle[] activeBundles = osgiJpaProvider.getBundleContext().getBundles();
        debug("GeminiExtender looking at existing bundles: ", activeBundles);
        
        // Check if any are p-unit bundles
        for (Bundle b : activeBundles) {
            if (isPersistenceUnitBundle(b)) {
                // We found a persistence unit bundle that has already been installed.
                // Refresh it so it will go through the resolving state again and client 
                // bundles that are waiting for the EMF service will not be hosed
                if (b.getState() != Bundle.INSTALLED) {
                    addToRefreshingBundles(b);
                    PackageAdmin admin = getPackageAdmin(osgiJpaProvider.getBundleContext());
                    debug("GeminiExtender refreshing packages of bundle ", b);
                    admin.refreshPackages(new Bundle[] { b }); 
                }
            }
        }
    }


If I comment out the admin.refreshPackages(...) the application starts without problems, no matter which startup level I have. However Gemini doesn't work (which suprise!).

Should I open a Bug?

- Muki
Re: Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #652086 is a reply to message #651407] Wed, 02 February 2011 16:22 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 243
Registered: July 2009
Senior Member
Hi Muki,

You may as well enter a bug explaining what you are seeing. I am not sure what, if anything, we will do about it because if the application is started before the provider is then the provider would not be able to weave the application unless a refresh is performed.

One option is that if the application does not require weaving then the refresh does not need to be performed. We would just need a way to know whether the app requires weaving...

-Mike
Re: Gemini JPA/dbaccess and Eclipse RCP Features (Sample) [message #653205 is a reply to message #650584] Tue, 08 February 2011 21:08 Go to previous message
Nepomuk Seiler is currently offline Nepomuk SeilerFriend
Messages: 88
Registered: December 2010
Member
Hi Mike,

This problem is really complex. I try to collect my different approaches, workarrounds and the resulting errors to write a summary.

I think only the startup is a problem. The Eclipse ExtensionPoints seem to be a big problem, because the bundle refreshing process confuses them. The same is with declarative services, however errors occured very rare.

After my test at university (just a few days left) I will have written my little paper. I really hope to use this for my application project as I want to use p2 as my update manager. And features don't support startlevels Sad

- Muki
Previous Topic:EclipseLink 2.2.0.rc3 renders broken against Gemini
Next Topic:Howto create customized EntityManagerFactory
Goto Forum:
  


Current Time: Tue Mar 19 03:13:52 GMT 2024

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

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

Back to the top