java - Eclipse Plugin Development - ClassCastException cannot cast abc.xyz to abc.xyz -
i developing plugin in eclipse. have encountered problem following code:
xyz object1 = xyz(object2);
where said line throws exception:
caused by: java.lang.classcastexception: abc.xyz cannot cast abc.xyz
xyz class plugin. unfortunately, said plugin not have packages visible. so, setting dependency threw classdefnotfound
exception.
luckily, have .jar
of plugin , added plugin's build path. when did so, still returned classdefnotfound
exception. looked around , found out plugins, referenced libraries not 'detected' jvm automatically, , so, followed solution add said jar manifest.mf
, bin.includes
section of plugin's build.properties
.
after following said solution, tried again , have classcastexception. atleast, @ point, class xyz
jar file being loaded. doing research, found out classloaders of both xyz
classes different. quite stuck on steps should do.
here's summary of whole problem:
- required class plugin. said plugin not have classes visible.
- added dependency plugin's jar file build path.
- classdefnotfoundexception thrown.
- updated plugin's manifest.mf , build.properties config.
- classcastexception thrown.
it great if has solution problem or inputs on can fix this.
thank in advance help/input provided.
you can't this. eclipse plugin system designed prevent accessing classes not exported.
including plugin jar in plugin use different class loader class loader , class cast exception.
the way access these classes other plugin modified export these classes.
Comments
Post a Comment