Another entities-cannot-be-cast-to-javassist-util-proxy-proxy

后端 未结 3 1066
北海茫月
北海茫月 2021-01-18 08:09

Following thread [entities cannot be cast to javassist.util.proxy.Proxy, i do have now a server side error ( tks thomas) I wasn\'t able to face the real problem within my ap

相关标签:
3条回答
  • 2021-01-18 08:22

    I also hit this issue while attempting to render an entity as JSON using Spring's @ResponseBody annotation. The issue turned out to be a relationship annotated as @ManyToOne with a FetchType of LAZY. The error message was not at all helpful. Switching to EAGER fetch solved the problem.

    It may be helpful to note that in my case, the target entity also had a relationship of @ManyToOne which was recursive (target table had a foreign key to itself) which was also mapped as LAZY. Both relationships had to be switched to EAGER to get the problem resolved.

    0 讨论(0)
  • 2021-01-18 08:35

    So I ran into this issue, and I thought I would add some additional details for those who might have the same problem.

    I had a collection of dependencies, and one imported org.javassist:javassist:3.18.1-GA, while the other imported javassist:javassist:3.11.0.GA.

    Because of the different groups (it would seem that javassist:javassist became org.javassist:javassist), the build tool wasn't excluding one in favour of the other, and my WAR file had both.

    I had to manually exclude the old javassist dependency, and once it was removed everything was fine.

    0 讨论(0)
  • 2021-01-18 08:39

    I encountered the same error and the strange thing is that all the other entities in my project run ok, except one. According to Boris the Spider's suggestion, I checked my project and found that there is a jar called weld-osgi-bundle.jar(in theJava EE 6 Libraries, provided by myEclipse10.0) contains some javassist code which may be conflict with javassist-3.18.1-GA.jarin my web libraries. So I removed it, and the problem gets solved.

    0 讨论(0)
提交回复
热议问题