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
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.
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.
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.