Getting class cast exception where both classes are exactly the same

后端 未结 5 1474
天涯浪人
天涯浪人 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:16

    This is because the class has been loaded by two different classloaders. You cannot cast between them.

    You've likely got a duplicate copy of CsiTipoLav in your application, and the two different copies are being loaded at different times from different classloaders. JBoss has a plethora of different classloaders in a hierarchy, and it's easy to get things in a twist.

    Make sure you only have one copy of the class.

提交回复
热议问题