classloader - ClassCastException by cast to owe type -
in implementation of org.dozer.beanfactory.createbean(object, class<?>, string)
try cast object type of it. if deploy bundles, shut down , start bundles got classcastexception:
java.lang.classcastexception: de.xxx.configuration cannot cast de.xxx.configuration
i suspect problem classloaders of karaf and/or dozer. class 1 time exists in jars , isn't modified. configuration doesn't implement serializeable , has no serial version id.
how avoid exception?
kind regards
if have exception someclass can not cast someclass signal these 2 classes have different classloaders. means loaded 2 different classloaders. example if have bundle , b, both contains someclass, each class different , object of class loaded bundle can not cast type loaded bundle b.
since pointing have class in 1 jar recommend check if have no entries in lib/ directory (dozer can load through sun.misc.appclassloader). put breakpoint in dozer beanfactory , inspect object instance class , class object passed createbean method. should bundle class loaders used. since fixing issue easier.
Comments
Post a Comment