Getting class cast exception where both classes are exactly the same

后端 未结 5 1477
天涯浪人
天涯浪人 2020-11-27 07:16

I am doing a JBoss SEAM project and when I view a form I get this error.

java.lang.ClassCastException:
it.cogitoweb.csi.entity.csiorelav.CsiTipoLav cannot be         


        
5条回答
  •  温柔的废话
    2020-11-27 07:33

    This happens when two different ClassLoader objects load classes with the same name. The equality of two classes in Java depends on the fully qualified name and the class loader that loaded it.

    So if two independent class loaders load classes from the same location, then objects of those types will not be able to be cast to each others type, even if their classes are called the same.

提交回复
热议问题