Startorder of bundles [message #908387] |
Wed, 05 September 2012 05:48  |
Eclipse User |
|
|
|
Hi together,
yesterday evening i spent a lot of time to run a JUnit Plugin test based on Gemini JPA.
My big problem was, that the persistence bundle (containing jpa entities) and the bundle containing the tests became restarted automatically by gemini. (Sure, since the class files may be changed!)
So i read a lot of blog entries and detected the workaround by start level.
So i ensured, that the start level of gemini.jpa is lower (eg 4) as the start level of my persistence bundle (eg 5).
But it does not work! Everytime the persistence bundle becomes restarted and i am getting class loader problems.
So i checkedout source from git and detected, that there is maybe a bug in gemini. I am not an expert about gemini jpa, but if i am changing the following, then everything seems to be fine and the persistence bundle is not restarted anymore, if the start levels are set properly.
I changed PersistenceBundleExtender#lookForExistingBundles():
// We found a persistence unit bundle.
if (GeminiProperties.refreshPersistenceBundles()) {
// If bundle is active then refresh it and push it through
// the life cycle again
// so it will go through resolving and we can assign it a
// provider, etc.
// if ((b.getState() != Bundle.INSTALLED) && (b.getState()
// != Bundle.UNINSTALLED)) {
if (b.getState() == Bundle.ACTIVE) {
refreshBundle(b);
} else if (b.getState() == Bundle.RESOLVED) {
tryAssigningPersistenceUnitsInBundle(b);
}
I added following code. If the persistence bundle was found, and its state is just resolved, i try to assign it.
} else if (b.getState() == Bundle.RESOLVED) {
tryAssigningPersistenceUnitsInBundle(b);
}
Since i am not an expert, i thought i will ask here before opening a bug.
What do you think about the change above?
Best,
Florian
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08309 seconds