1 Reply Latest reply on Nov 12, 2008 3:17 AM by Adam Warski

    Exceptions loading entity versions

    talios Newbie

      'lo all,

      When trying to load versioned copies of my entities, I'm getting the following exception:

      Caused by: org.jboss.envers.exception.VersionsException: java.lang.InstantiationException
       at org.jboss.envers.entity.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:69)
       at org.jboss.envers.entity.EntityInstantiator.addInstancesFromVersionsEntities(EntityInstantiator.java:86)
       at org.jboss.envers.query.impl.EntitiesAtRevisionQuery.list(EntitiesAtRevisionQuery.java:78)
       at org.jboss.envers.query.impl.AbstractVersionsQuery.getSingleResult(AbstractVersionsQuery.java:78)
       at org.jboss.envers.reader.VersionsReaderImpl.find(VersionsReaderImpl.java:99)
       at org.jboss.envers.reader.lazy.ToOneDelegateSessionImplementor.doImmediateLoad(ToOneDelegateSessionImplementor.java:46)
       at org.jboss.envers.reader.lazy.AbstractDelegateSessionImplementor.immediateLoad(AbstractDelegateSessionImplementor.java:55)
       at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:66)
       at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
       at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
       at smx3.schema3.Party$$EnhancerByCGLIB$$410dd201.hashCode(<generated>)
       at java.util.HashMap.getEntry(HashMap.java:344)
       at java.util.HashMap.containsKey(HashMap.java:335)
       at java.util.HashSet.contains(HashSet.java:184)
       at flexjson.ChainedSet.contains(ChainedSet.java:26)
       at flexjson.JSONSerializer$ObjectVisitor.bean(JSONSerializer.java:575)
       ... 70 more
      Caused by: java.lang.InstantiationException
       at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
       at java.lang.Class.newInstance0(Class.java:355)
       at java.lang.Class.newInstance(Class.java:308)
       at org.jboss.envers.entity.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:67)
       ... 85 more
      


      From what I've been able to gather, I'm guessing envers is trying to match some lookup data in other versioned entities thats missing ( i.e. lookups in party_type were manually inserted via SQL into the original schema, and didn't have matching party_type_versions records).

      Is any easy way of tracking down what data's triggering this?

        • 1. Re: Exceptions loading entity versions
          Adam Warski Master

          Hello,

          this looks like an exception is thrown in the constructor of a related entity - the cause of the exception is "InstantiationException" which is thrown in "Constructor.newInstance".

          From what I can tell from the exception, the exception is thrown when loading a related entity (x-to-one relation).

          The only easy way of tracking this that I can imagin is debugging :). (Or SOD-debugging by changing Envers code ;) )

          --
          Adam