JaversException TYPE_NAME_NOT_FOUND: type name contains '$$EnhancerByCGLIB$$'

145 Views Asked by At

Calling Javers.findChanges() results in the mentioned exception. It looks like my Pojo was somehow proxied or generated by CGLIB. Strange, because I am not using JPA/Hibernate but MongoDB. Two questions,

  1. is there a way to prevent this in the future?
  2. is there a way to "fix" the jv_snapshots table or extend Javers somehow to deserialize this Pojos correctly?

Thank your

1

There are 1 best solutions below

3
On

Your application should not commit CGLIB proxies to JaVers. When you are using JPA/Hibernate, JaVers automatically unproxies your entities (see https://javers.org/documentation/spring-integration/#hibernate-unproxy-hook).

I don't know why your application generates those proxies, maybe some AOP framework? It doesn't happen in typical Spring configuration for Mongo. It's not clear why you have jv_snapshots table since you said that you are using MongoDB.