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  |
Eclipse User |
|
|
|
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 #439072 is a reply to message #439068] |
Mon, 31 October 2005 11:56   |
Eclipse User |
|
|
|
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 #439075 is a reply to message #439068] |
Mon, 31 October 2005 12:02   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
> 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.
|
|
|
Goto Forum:
Current Time: Tue Sep 16 10:48:58 EDT 2025
Powered by FUDForum. Page generated in 0.04613 seconds
|