Hibernate exception _$$_javassist_0 cannot be cast to javassist.util.proxy.Proxy

前端 未结 14 1281
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 09:33

Hello I am using developnig java web application and I am getting the next exception when I am trying to fetch data using hibernate

java.lang.ClassCastExcept         


        
14条回答
  •  失恋的感觉
    2020-12-05 10:08

    I have been using 4.2.8-Final version of hibernate and was having this issue and went through the below answers/suggestions earlier. Here is the sequence of events I made - To get rid of the issue with 4.2.8-Final, was using "parent classes last" class loader approach in Websphere. Recently when the project grew in size (by having more hibernate related jar flavors), started to get the same issue.

    Finally excluded the "javassist" from hibernate

    
    org.hibernate
    hibernate-core
    ${hibernate.version}
    
        
            org.javassist
            javassist
        
    
    

    and added

    
    org.javassist
    javassist
    3.18.1-GA 
    

    Even this didn't resolve the problem completely (still I had to use 'parent last' class loader approach with hibernate to get rid of the issue.

    Finally I downgraded hibernate version from 4.2.8-Final to 4.2.7-Final and the issue is solved (I need not change my class loader preference in websphere admin console as parent last anymore)

    Not exactly sure what change in 4.2.8 Hibernate is causing this issue. Curious to know.

提交回复
热议问题