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

前端 未结 14 976
伪装坚强ぢ
伪装坚强ぢ 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:27

    I had the same problem with Spring Data JPA. I confirm it comes from javassit conflict. The solution is :

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>javassist</artifactId>
                <groupId>org.javassist</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    
    <dependency>
        <groupId>org.javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.18.2-GA</version>
        <scope>compile</scope>
    </dependency>
    
    0 讨论(0)
  • 2020-12-05 10:35

    I had similar issue on JBoss EAP 7.1.3 (EAP 6.0.1) for hibernate 4.2.x. Its because JBoss modules already contains javassist lib.

    I solved it by creating jboss-deployment-structure.xml in WEB-INF directory with such content:

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
      <deployment>
        <exclusions>
          <module name="org.javassist"/>
        </exclusions>
        <local-last value="true" />
      </deployment>
    </jboss-deployment-structure>
    
    0 讨论(0)
提交回复
热议问题