Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Questions running hibernate
Questions running hibernate [message #631922] Sun, 10 October 2010 16:47 Go to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I made some progress finally. I had to make some dependency hacks to install jpa2 (hard dependency on 1.0 in ...catalina.springsource, spring.orm won't resolve or at least bind to wrong version when both versions installed)

Now guess I have my own hibernate library bundle (latest version) that wants to load a PostUpdateEventListener from my services bundle. I tried the buddy-policies from eclipse but they seem not to be supported on virgo. I tried to import the package from my services in the hibernate bundle (which should be circular then) but still I get CNF Exception.

What would we the best way to make hibernate load my class? What about the entites (yet another bundle) I used to solve that with buddy class loading and it would be great if you give me an idea how to achieve that on virgo.

Btw I had to install spring 3.0.4 to make jpa2 work (bugs in 3.0.0) and then I find the admin console broken (depency on springframework.js -- I have to search for this)

Any help would be appreciated,

regards Thomas
Re: Questions running hibernate [message #631987 is a reply to message #631922] Mon, 11 October 2010 07:20 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I guess I could use import-scope:application but then I need a dummy bundle to import that package. Would be nice if we could see Buddy-Class Loading here
Re: Questions running hibernate [message #632012 is a reply to message #631922] Mon, 11 October 2010 08:26 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Thomas Kratz wrote on Sun, 10 October 2010 17:47
Btw I had to install spring 3.0.4 to make jpa2 work (bugs in 3.0.0) and then I find the admin console broken (depency on springframework.js -- I have to search for this)


To use Spring 3.0.4, you should replace just the Spring framework JARs and the Spring .libd file in repository ext with the later version. The org.springframework.js bundle is actually part of Spring web and need not be replaced. Did you delete it from repository/ext and not replace it?
Re: Questions running hibernate [message #632013 is a reply to message #631987] Mon, 11 October 2010 08:28 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
import-scope:=application will only import into the other bundles of the application, so why not code import-scope:=application in one of those bundles rather than add a dummy bundle?
Re: Questions running hibernate [message #632015 is a reply to message #632013] Mon, 11 October 2010 08:34 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
Hi Glyn, sorry for putting that in bugzilla, I guess here is the better place. The package hibernate needs is in my services bundle which is currently at the top if my bundle hierarchy. So the package is currently imported from nowhere else. Where would you put the import ? In the service bundle ? will that work ? I guess import wont reference packages inside the actual bundle.
Re: Questions running hibernate [message #632020 is a reply to message #632015] Mon, 11 October 2010 08:53 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Yes, let's continue this conversation here so others may benefit.

the basics of OSGi are that a class can only be loaded by the bundle that contains it or by another bundle that is wired to a package export of the bundle that contains it. Wiring is specified using import-package, import-bundle, or occasionally import-library. The crucial thing in this situation is to make sure the bundle containing the class to be loaded from elsewhere actually exports the class. If you have used bundlor or bnd to generate the manifest, then it should.

As for scoped plans, see the Virgo programmer guide for starters. Smile
Re: Questions running hibernate [message #632025 is a reply to message #632020] Mon, 11 October 2010 09:11 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
So if I have an export in a bundle thats contained in a plan its automatically visible to other bundles in the plan ? Thats different from what I'm used to.
Re: Questions running hibernate [message #632033 is a reply to message #632025] Mon, 11 October 2010 10:03 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Nearly. Wink

Other bundles in the same plan still have to import the package (or import-bundle etc.) but the crucial point is that exports of all bundles in the plan are imported by the synthetic context bundle and made available for thread context class loading for the likes of Hibernate.
Re: Questions running hibernate [message #632049 is a reply to message #632033] Mon, 11 October 2010 11:28 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I have to inestigate this. I definitifly exported the package, but hibernate failed to load it.
Re: Questions running hibernate [message #632113 is a reply to message #632049] Mon, 11 October 2010 15:41 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I double checked. Package is exported, plan is scoped.
I get
Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: de.eiswind.mango.server.hibernate.PostUpdateEventListener in KernelBundleClassLoader: [bundle=eiswind-publishing-server.plan-1-de.eiswind.org.hibernate_3.5.6]
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
	at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1763)
	... 36 common frames omitted
Caused by: java.lang.ClassNotFoundException: de.eiswind.mango.server.hibernate.PostUpdateEventListener
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)
	... 41 common frames omitted



Any ideas ? Regarding to your post this should work


Re: Questions running hibernate [message #632116 is a reply to message #632113] Mon, 11 October 2010 15:50 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
It looks like you are including Hibernate in the plan, which is not the normal approach as multiple applications may wish to share Hibernate. If you place Hibernate in repository/usr instead and take it out of your plan, Virgo will fault it in when your application is installed (because parts of your app import Hibernate packages) and then the thread context class loader will be set when Hibernate is called, since it will be outside the scope and IIRC that's what drives us to set the TCCL.
Re: Questions running hibernate [message #632121 is a reply to message #632116] Mon, 11 October 2010 16:13 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I have tried that with the same CNF result. Twisted Evil
Re: Questions running hibernate [message #632126 is a reply to message #632121] Mon, 11 October 2010 16:24 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
That's a shame. It seems like Hibernate is not doing its usual thread context class loading. However, this is a newer version of Hibernate than we've used in the past, so maybe it has changed significantly.

Have you tried hacking a package import for de.eiswind.mango.server.hibernate into the Hibernate manifest? Although this is not a long-term solution, it might get you further. If it works, there is a proper way to do it by attaching a fragment to the Hibernate bundle, but let's cross that bridge if we get to it.
Re: Questions running hibernate [message #632128 is a reply to message #632121] Mon, 11 October 2010 16:39 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
After some clean and restart it seems to work now ! sts tooling fooled me. Thanks for helping me out !
Re: Questions running hibernate [message #632135 is a reply to message #632128] Mon, 11 October 2010 17:07 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
You're welcome. What exactly worked in the end?
Re: Questions running hibernate [message #632211 is a reply to message #632135] Tue, 12 October 2010 06:52 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
You were right that I had the hibernate bundle in my plan. I removed it and put in in repository/usr which caused sts tooling obvously some trouble. I guess I will habe more questions coming up Smile Thanks again for the great support.
Re: Questions running hibernate [message #646260 is a reply to message #632211] Wed, 22 December 2010 22:50 Go to previous message
Eva Troels is currently offline Eva TroelsFriend
Messages: 17
Registered: December 2010
Junior Member
I am also getting this CNF exception - I tried cleaning and restarting but with no luck.
I would like to know which jars are supposed to go into the usr folder and how the manifest file should look like.
Previous Topic:JAX-RS + Virgo?
Next Topic:ArtifactGenerationException: Manifest ill-formed.
Goto Forum:
  


Current Time: Thu Mar 28 19:49:06 GMT 2024

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

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

Back to the top