[Gvsig_english] PluginClassLoader problem

ulkaef at op.pl ulkaef at op.pl
Wed Jun 4 15:25:43 CEST 2008


Greetings,

I am new to the gvSIG and am having some problems that perhaps you can solve.

I installed the environment as described in readme file (at least I think I did) and at the moment I am trying to run the project from Eclipse IDE. I experienced strange problem in method PluginServices.getPluginServices. (the body of the method is listed at the end of the mail). Apparently, it tries to get the PluginServices for plugin class instance which is of type com.iver.cit.gvsig.ProjectExtension (debugger confirmed). The problem arises while casting the class loader to PluginClassLoader type. Since pluginClassInstance is an extension, it is expected that its loaded by PluginClassLoader while in fact - again, according to the Eclipse debugger - it's been loaded by loader of type sun.misc.Launcher$AppClassLoader instead of com.iver.andami.plugins.PluginClassLoader. Thus, the code fails with ClassCastException. The code and extension is "out of the box" - no changes been made yet so I don't really know what is the problem - is it possible to force loading by different class loader perhaps?

I hope you can help me in solving this problem.

Thanks in advance,

Ula Florianczyk

(and the code of the method that fails) 

public static PluginServices getPluginServices(Object pluginClassInstance) {
??
??try {
???
???/* THE CODE BELOW FAILS  - u.f. comment */
???PluginClassLoader loader = (PluginClassLoader) pluginClassInstance
?????.getClass().getClassLoader();
???

???return Launcher.getPluginServices(loader.getPluginName());
??} catch (ClassCastException e) {??????

???/*
??? * throw new RuntimeException( "Parameter is not a plugin class
??? * instance");
??? */
???return null;
??}
?}


More information about the Gvsig_internacional mailing list