|(no subject) [message #703769 is a reply to message #702624]
||Wed, 27 July 2011 22:03
| Wim Jongman
Registered: July 2009
Yes classloader tricks are a no-go in OSGi/RCP.
Your binaries are not visible but I am guessing that your graps can come and
go. I think you should look at OSGi dynamic services or at Extension Points.
Basically, a graph bundle should register itself through an OSGi service or
an Extension point where it can be picked up by the VM plugin.
Again, do not fiddle with the classloader.
> Hey there,
> I'm facing a problem concerning dynamic class loading. I have a file
Algorithm.java (pastebin . com/ CdGXdPFw) which is compiled by an instance of
the javax.tools.JavaCompiler API. After that it's supposed to be loaded and a
new instance is supposed to be created. All this takes place in a RCP
project, let's call it VM.
> The algorithm needs (as you can see in the source code) some datatypes from
other plugins, let's call one of these other plugins "graph". However, the
graph-plugin must not appear in the required-plugins section of VM's
> This is where my problem lies:
> I try to create an instance of Algorithm using this code:
> algoInst = (AbstractAlgo) algoClass.getConstructors().newInstance();
> But it gives me class loading errors: pastebin . com/ k18gcpKS
> So i tried to created a URLClassLoader with the URL to the Graph package et
voila, this works:
> Even when I tried to call newInstance like this:
> algoInst = (AbstractAlgo) Class.forName(algoClass.getName(), false,
> it does not work, although this loader is able to load PCGraph...
> How do I get the instance of Algorithm using this class loader? I'm
probably missing some RCP/ClassLoading-Basics here and need another pair of
> Thanks for your help!
Powered by FUDForum
. Page generated in 0.17851 seconds