2 Replies Latest reply on Oct 23, 2008 5:51 AM by adamw

    getReflectionManager

    vbforums

      Hi,

      I am trying to configure envers in Spring-Hibernate environment. Below are the jar versions that I am using

      Envers: envers-1.0.0.ga.jar
      Hibernate: hibernate-3.2.6.jar

      Also,
      hibernate-entitymanager.jar
      hibernate-commons-annotations.jar
      hibernate-annotations.jar
      ejb3-persistence.jar

      plus other jars. To instantiate in spring I use the below bean definition

      <bean id="eventListeners" class="java.util.HashMap">
       <constructor-arg index="0" type="java.util.Map">
       <map>
       <entry key="post-update">
       <bean id="updateEventListener" class="org.jboss.envers.event.VersionsEventListener" />
       </entry>
       <entry key="post-delete">
       <bean id="delete1EventListener" class="org.jboss.envers.event.VersionsEventListener" />
       </entry>
      </map>
      </constructor-arg>
      </bean>
      
      


      If I follow this configuration, I get the below error message
      org.hibernate.MappingException: java.lang.NoSuchMethodException: getReflectionManager
       at org.jboss.envers.configuration.VersionsConfiguration.getReflectionManager(VersionsConfiguration.java:94)
       at org.jboss.envers.configuration.VersionsConfiguration.configure(VersionsConfiguration.java:119)
       at org.jboss.envers.configuration.VersionsConfiguration.getFor(VersionsConfiguration.java:238)
       at org.jboss.envers.event.VersionsEventListener.initialize(VersionsEventListener.java:125)
       at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:417)
       at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1310)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
       at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:805)
       at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:745)
       at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1202)
      


      Any help on this is much appreciated.

      Thanks



        • 1. Re: getReflectionManager
          adamw

          Hello,

          is it the way you configure hibernate event listeners in spring? Not through hibernate configuration files?

          Anyway, the error is quite weird. Maybe Spring uses some wrapper around Hibernate's Configuration? Hard to say without looking at the code :). Would it be possible for you to create a simple Spring project which would demonstrate this exception (a failing test case) and send it to me? (as an attachement to a JIRA case, for example?)

          --
          Adam

          • 2. Re: getReflectionManager
            adamw

            Hello,

            I accidentally bumped into your problem. I suppose you're using "pure" hibernate, without entity manager/annotations?

            The exception comes from the fact that I assumed that you use annotations or entity manager; then the "reflection manager" is available. I haven't resolved this yet; there's a JIRA issue in case you want to follow: https://jira.jboss.org/jira/browse/ENVERS-63.

            Maybe you can use the AnnotationConfiguration until this is fixed?

            --
            Adam