Startorder of bundles [message #908387] |
Wed, 05 September 2012 09:48 |
|
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
|
|
|
|
|
Re: Startorder of bundles [message #912325 is a reply to message #908508] |
Thu, 13 September 2012 10:50 |
|
Right now i am wondering about the best practice using gemini jpa and
how other projects are using it.
Question to products that already use gemini:
How are you using gemini jpa?
- Did you turn off dynamic weaving?
- Or did you change the startorder of the bundles a way, that gemini jpa
does not have to re-resolve the persistence unit?
- Or are you handling the re-resolving internally?
Would be really interesting for me. Then i get an idea what will be best
practice and how i can use it.
Thanks a lot for any hints and discussion...
Best,
Florian
|
|
|
|
Powered by
FUDForum. Page generated in 0.04385 seconds