Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » trouble with hibernate classloading using multiple plugins
trouble with hibernate classloading using multiple plugins [message #439068] Mon, 31 October 2005 09:59 Go to next message
Eclipse UserFriend
i am currently developing an RCP application with the eclipse framework.
my project contains several plugins. there is one plugin for hibernate
setup and configuration:

HibPlugin

that plugin is used by other plugins, which are contributed by other
developers:

UserPlugin

now the UserPlugin has a mapping file and the corresponding java class.
loading the mapping file via an extension point and passing it to
hibernate works, but now hibernate (HibPlugin) tries to get the class
referenced in the mapping file (in UserPlugin), which the HibPlugin
doesnt know, and it therefore fails with an ClassNotFoundException.

does someone know, if the OSGi framework can be configured, so that the
hibernate plugin gets a classloader, which finds the class files in all
source folders of all plugins?

i searched in the hibernate forum and the eclipse newsgroup, eclipse
help, etc., but could not find a solution.

i tried to re-export the dependencies
i tried the Eclipse-BuddyPolicy (all possible values: dependent, global,
boot, app and registered)

now, i dont have any clue how to solve that, since i cannot change the
dependencies of the HibPlugin.

regards
hendrik
Re: trouble with hibernate classloading using multiple plugins [message #439071 is a reply to message #439068] Mon, 31 October 2005 10:35 Go to previous messageGo to next message
Eclipse UserFriend
> i tried the Eclipse-BuddyPolicy (all possible values: dependent, global,
> boot, app and registered)
>
I think the BuddyPolicy's should work. Take a look at eclipse-jaas
source (sourceforge project) wich uses a similar mechanism to load
classes from other projects.

Markus Wolf
--
>
> emedia-solutions wolf
> Wedeler Landstrasse 63
> 22559 Hamburg
>
>> phone: (+49) 40 550 083 70
>> web: http://www.emedia-solutions-wolf.de
>> mail: markus@emedia-solutions-wolf.de
>> pgp: http://wwwkeys.de.pgp.net
>
Re: trouble with hibernate classloading using multiple plugins [message #439072 is a reply to message #439068] Mon, 31 October 2005 11:56 Go to previous messageGo to next message
Eclipse UserFriend
Hendrik,
This is short buddy policy example (it work for me) :
in HibPlugin add in MANIFEST.MF :

Eclipse-BuddyPolicy: registered

in UserPlugin add in MANIFEST.MF

Eclipse-RegisterBuddy: HibPlugin

change HibPlugin with ID of hibernate plugin

Peco
Hendrik wrote:

>
> i am currently developing an RCP application with the eclipse framework.
> my project contains several plugins. there is one plugin for hibernate
> setup and configuration:
>
> HibPlugin
>
> that plugin is used by other plugins, which are contributed by other
> developers:
>
> UserPlugin
>
> now the UserPlugin has a mapping file and the corresponding java class.
> loading the mapping file via an extension point and passing it to
> hibernate works, but now hibernate (HibPlugin) tries to get the class
> referenced in the mapping file (in UserPlugin), which the HibPlugin
> doesnt know, and it therefore fails with an ClassNotFoundException.
>
> does someone know, if the OSGi framework can be configured, so that the
> hibernate plugin gets a classloader, which finds the class files in all
> source folders of all plugins?
>
> i searched in the hibernate forum and the eclipse newsgroup, eclipse
> help, etc., but could not find a solution.
>
> i tried to re-export the dependencies
> i tried the Eclipse-BuddyPolicy (all possible values: dependent, global,
> boot, app and registered)
>
> now, i dont have any clue how to solve that, since i cannot change the
> dependencies of the HibPlugin.
>
> regards
> hendrik
Re: trouble with hibernate classloading using multiple plugins [message #439074 is a reply to message #439071] Mon, 31 October 2005 11:00 Go to previous messageGo to next message
Eclipse UserFriend
Markus Wolf wrote:
>> i tried the Eclipse-BuddyPolicy (all possible values: dependent, global,
>> boot, app and registered)
>>
> I think the BuddyPolicy's should work. Take a look at eclipse-jaas
> source (sourceforge project) wich uses a similar mechanism to load
> classes from other projects.
>
> Markus Wolf

do i have to write the keywords at a certain position in the Manifest file?
i also moved the class referenced by the mapping file from an
"*.internal" package to an root package, which is exported, also that
doesn't help.
could it be, that the policies dependent, global don't work, when in the
plugin in with the needed class the Eclipse-RegisterBuddy header is set?

hendrik
Re: trouble with hibernate classloading using multiple plugins [message #439075 is a reply to message #439068] Mon, 31 October 2005 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Folks will say use the buddy policy. But I dont see how this will work
if you are not the published of the hibernate plugin. Plus when you
release updates or new plugins, you need the hibernate plugin to be
changed to know your plugin as a buddy!?

I think instead the hibernate plugin needs to act like a plugin and not
a library holder. it needs to expose a service of some sort so that it
can be used by your plugin to load classes on behalf of your plugin.
Perhaps you can fashion the hibernate plugin to accept a classloader to
use to load the requested classes. Or rather when you pass the mapping
file to hibernate, pass a classloader along with it.


CL


Hendrik wrote:
>
> i am currently developing an RCP application with the eclipse framework.
> my project contains several plugins. there is one plugin for hibernate
> setup and configuration:
>
> HibPlugin
>
> that plugin is used by other plugins, which are contributed by other
> developers:
>
> UserPlugin
>
> now the UserPlugin has a mapping file and the corresponding java class.
> loading the mapping file via an extension point and passing it to
> hibernate works, but now hibernate (HibPlugin) tries to get the class
> referenced in the mapping file (in UserPlugin), which the HibPlugin
> doesnt know, and it therefore fails with an ClassNotFoundException.
>
> does someone know, if the OSGi framework can be configured, so that the
> hibernate plugin gets a classloader, which finds the class files in all
> source folders of all plugins?
>
> i searched in the hibernate forum and the eclipse newsgroup, eclipse
> help, etc., but could not find a solution.
>
> i tried to re-export the dependencies
> i tried the Eclipse-BuddyPolicy (all possible values: dependent, global,
> boot, app and registered)
>
> now, i dont have any clue how to solve that, since i cannot change the
> dependencies of the HibPlugin.
>
> regards
> hendrik
Re: trouble with hibernate classloading using multiple plugins [message #439095 is a reply to message #439068] Tue, 01 November 2005 18:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: siselenews.gmx.de

Hi,
may be this helps :
http://opensource2.atlassian.com/projects/hibernate/browse/H B-1310 :

".....
We currently allow a customizable classloader for addResource(), but
this only loads the mappings with the given classloader. We would need
an option to specify a classloader for the persistent classes as well,
basically, for all Hibernate operations. "

This could mean, yoy cannot tell hibernate witch classloader to use
for a persistent Class. Does not sound good !!

Reading your question I recognized I will run into the same problem in
the next weeks, did not even think about this !


On Mon, 31 Oct 2005 12:02:20 -0500, in eclipse.platform.rcp you wrote:

>Folks will say use the buddy policy. But I dont see how this will work
>if you are not the published of the hibernate plugin. Plus when you
>release updates or new plugins, you need the hibernate plugin to be
>changed to know your plugin as a buddy!?
>
>I think instead the hibernate plugin needs to act like a plugin and not
>a library holder. it needs to expose a service of some sort so that it
>can be used by your plugin to load classes on behalf of your plugin.
>Perhaps you can fashion the hibernate plugin to accept a classloader to
>use to load the requested classes. Or rather when you pass the mapping
>file to hibernate, pass a classloader along with it.
>
>
Re: trouble with hibernate classloading using multiple plugins [message #439445 is a reply to message #439068] Tue, 08 November 2005 03:02 Go to previous message
Eclipse UserFriend
> i tried the Eclipse-BuddyPolicy (all possible values: dependent, global,
> boot, app and registered)

somehow that works. i don't know what my app and hibernate are doing,
but it works with the Eclipse-BuddyPolicy. however, now i have a strange
problem, everytime i give the mapping files to hibernate, i get a
ClassNotFoundException from the hibernate-parsing-code. but when
hibernate creates new instances due to DB access, it mystericaly works fine.

seems, like i have to live with that exception...

didnt try it yet with eclispe 3.2Mx.
Previous Topic:What is the purpose of eclipse-RCP vs eclipse-RCP-SDK
Next Topic:RCP Application deployment problem - PreferenceStore
Goto Forum:
  


Current Time: Tue Sep 16 10:48:58 EDT 2025

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

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

Back to the top