1 2 Previous Next 17 Replies Latest reply on Apr 8, 2009 9:01 AM by Adam Warski

    getting java.lang.NoSuchMethodException after adding persist

    Arthur Kalmenson Newbie

      Hello everyone,

      I'm trying to set up Envers 1.1.0.GA with our current project. Following the Quick Start guide, I added the "hibernate.ejb.event.*" settings to my persistence.xml file. As soon as I tried to launch the application, it crashes with the following error:

      Caused by: java.lang.NoSuchMethodException: org.hibernate.reflection.java.JavaXFactory.equals(org.hibernate.annotations.common.reflection.XClass, java.lang.Class)
      at java.lang.Class.getMethod(Class.java:1581)
      at org.jboss.envers.tools.reflection.YMethodsAndClasses.(YMethodsAndClasses.java:72)
      at org.jboss.envers.tools.reflection.YReflectionManager.(YReflectionManager.java:41)
      at org.jboss.envers.tools.reflection.YReflectionManager.get(YReflectionManager.java:66)
      at org.jboss.envers.configuration.VersionsConfiguration.(VersionsConfiguration.java:72)
      at org.jboss.envers.configuration.VersionsConfiguration.getFor(VersionsConfiguration.java:93)
      at org.jboss.envers.event.VersionsEventListener.initialize(VersionsEventListener.java:192)
      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.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)



      I haven't added any @Versioned annotations anywhere. JPA is currently being initialized with Spring. My persistence.xml file looks as follows:

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
      version="1.0">
      <persistence-unit name="credentialing">
      org.hibernate.ejb.HibernatePersistence

      <!-- Grab all the domain objects. -->
      ...
      ...




      <!--
      Add properties to get Envers to automatically version our beans.
      -->







      </persistence-unit>



      Any help would be greatly appreciated. Thank you.

      Best regards,
      Arthur Kalmenson

        • 1. Re: getting java.lang.NoSuchMethodException after adding per
          Adam Warski Master

          Hello,

          which version of Hibernate are you using?

          --
          Adam

          • 2. Re: getting java.lang.NoSuchMethodException after adding per
            Arthur Kalmenson Newbie

            Hi Adam,

            I'm using version 3.2.6.ga.

            Best regards,
            Arthur Kalmenson

            • 3. Re: getting java.lang.NoSuchMethodException after adding per
              Adam Warski Master

              Weird :)
              I assume you grabbed the 1.1.0.ga release for hibernate 3.2.6? Also, which version of annotations and entity manager do you have?

              --
              Adam

              • 4. Re: getting java.lang.NoSuchMethodException after adding per
                Arthur Kalmenson Newbie

                Yeah, definitely got the hibernate 3.2.6 version. I'm using Maven (put Envers 1.1.0.ga into the local repo), so I have the following dependencies for hibernate:

                hibernate - 3.2.6.ga
                hibernate-annotations - 3.2.1.ga
                hibernate-commons-annotations - 3.0.0.ga
                hibernate-entitymanager - 3.2.1.ga

                • 5. Re: getting java.lang.NoSuchMethodException after adding per
                  Adam Warski Master

                  Hello,

                  maybe you could try using annotations 3.3 and entitymanager 3.3? According to http://hibernate.org/6.html these versions are compatible with 3.2.6.ga. I think that they may contain the missing method.

                  --
                  Adam

                  • 6. Re: getting java.lang.NoSuchMethodException after adding per
                    Arthur Kalmenson Newbie

                    Hello Adam,

                    That did it. After changing the version I got some CNFEs about some oswego concurrent library, which I found in JBoss' Maven repository: http://repository.jboss.com/maven2/oswego-concurrent/concurrent/. After that, I had some problems with the inheritance model we were using (doesn't support JOIN or TABLE_PER_CLASS), but otherwise it seems to work. Thank you very much!

                    Best regards,
                    Arthur Kalmenson

                    • 7. Re: getting java.lang.NoSuchMethodException after adding per
                      Adam Warski Master

                      Hello,

                      glad it works :) If you'd like to use other inheritance schemes, take a look at the "trunk" version - they are supported there. Also, watch the blog, as I'll be making a Hiberante-3.3 compatible release soon.

                      --
                      Adam

                      • 8. Re: getting java.lang.NoSuchMethodException after adding per
                        Puneet Swarup Newbie

                        Hi Adam,

                        Following is my configuration for Hibernate and i am trying to use Envers 1.0.0 GA release

                        hibernate.jar 3.2.0.cr5
                        hibernate-annotations.jar 3.3.0.GA
                        hibernate-commons-annotations.jar 3.0.0.GA
                        hibernate-entitymanager.jar 3.3.2.GA

                        persistence.xml

                        <!-- AUDIT USING ENVERS -->
                         <property name="hibernate.ejb.event.post-insert" value="org.jboss.envers.event.VersionsEventListener" />
                         <property name="hibernate.ejb.event.post-update" value="org.jboss.envers.event.VersionsEventListener" />
                         <property name="hibernate.ejb.event.post-delete" value="org.jboss.envers.event.VersionsEventListener" />
                         <property name="hibernate.ejb.event.pre-collection-update" value="org.jboss.envers.event.VersionsEventListener" />
                         <property name="hibernate.ejb.event.pre-collection-remove" value="org.jboss.envers.event.VersionsEventListener" />
                         <property name="hibernate.ejb.event.post-collection-recreate" value="org.jboss.envers.event.VersionsEventListener" />
                         <!-- AUDIT TABLE CONFIGURATIONS -->
                         <property name="org.jboss.envers.versionsTableSuffix" value="_V" />
                         <property name="org.jboss.envers.revisionFieldName" value="ver_rev" />
                         <property name="org.jboss.envers.revisionOnCollectionChange" value="true" />
                         <property name="org.jboss.envers.revisionFieldName" value="ver_rev" />


                        Now, if i keep the collection properties, i get

                        java.lang.ArrayStoreException: org.jboss.envers.event.VersionsEventListener

                        while commenting collection entries gives me

                        NoSuchMethodException exception

                        Please suggest how can i proceed.

                        Thanks in advance.

                        • 9. Re: getting java.lang.NoSuchMethodException after adding per
                          Adam Warski Master

                          Hello,

                          Hibernate 3.2.0 is pretty old. I haven't tested Envers with it. The earliest version that Hibernate works with is 3.2.4, the one you can find in AS 4.2. Can you upgrade to something newer?

                          Also, please post full exceptions, not just the name. The name doesn't have any value without the stack trace :)

                          Adam

                          • 10. Re: getting java.lang.NoSuchMethodException after adding per
                            Puneet Swarup Newbie

                            Hi,

                            I have updated the config to

                            Hibernate core 3.3.1 GA
                            Hibernate Annotations 3.4.0 GA
                            Hibernate EntityManager 3.4.0 GA
                            Hibernate-commons-annotations 3.3.0
                            Envers 1.2.0


                            and now i get



                            org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [giving-db-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [giving-db-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
                             at java.security.AccessController.doPrivileged(Native Method)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
                             at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
                             at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
                             at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
                             at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
                             at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
                             at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:880)
                             at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:596)
                             at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:365)
                             at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
                             at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
                             at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
                             at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
                             at org.apache.catalina.core.StandardContext.start(StandardContext.java:4352)
                             at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
                             at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:732)
                             at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
                             at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.apache.catalina.core.StandardContext.init(StandardContext.java:5300)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
                             at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:295)
                             at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:108)
                             at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
                             at org.jboss.web.WebModule.startModule(WebModule.java:83)
                             at org.jboss.web.WebModule.startService(WebModule.java:61)
                             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
                             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
                             at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
                             at $Proxy0.start(Unknown Source)
                             at org.jboss.system.ServiceController.start(ServiceController.java:417)
                             at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                             at $Proxy44.start(Unknown Source)
                             at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
                             at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
                             at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
                             at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
                             at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
                             at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                             at $Proxy45.start(Unknown Source)
                             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
                             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
                             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
                             at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                             at $Proxy9.deploy(Unknown Source)
                             at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
                             at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
                             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
                             at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
                             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
                             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
                             at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
                             at $Proxy0.start(Unknown Source)
                             at org.jboss.system.ServiceController.start(ServiceController.java:417)
                             at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                             at $Proxy4.start(Unknown Source)
                             at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
                             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
                             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
                             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
                             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                             at java.lang.reflect.Method.invoke(Unknown Source)
                             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
                             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                             at $Proxy5.deploy(Unknown Source)
                             at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
                             at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
                             at org.jboss.Main.boot(Main.java:200)
                             at org.jboss.Main$1.run(Main.java:508)
                             at java.lang.Thread.run(Unknown Source)
                            Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [giving-db-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
                             at java.security.AccessController.doPrivileged(Native Method)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
                             at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
                             at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
                             at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
                             at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
                             at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
                             at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
                             at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:270)
                             at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:122)
                             at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:78)
                             at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
                             at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:97)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1326)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
                             ... 149 more
                            Caused by: java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;
                             at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:78)
                             at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
                             at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:249)
                             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.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
                             at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
                             at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
                             at org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:91)
                             at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
                             ... 166 more


                            Please suggest.

                            • 12. Re: getting java.lang.NoSuchMethodException after adding per
                              Adam Warski Master

                              Hello,

                              this configuration should work fine. Are you sure you have the annotations and common-annotations in your classpath?

                              Adam

                              • 13. Re: getting java.lang.NoSuchMethodException after adding per
                                Puneet Swarup Newbie

                                Hi,

                                Yes i am pretty sure about it. All the jar files are in the classpath. Still getting exception.

                                Please suggest.

                                • 14. Re: getting java.lang.NoSuchMethodException after adding per
                                  Adam Warski Master

                                  Doing javap on the AnnotationConfiguration class from the hibernate-annotations-3.4.0.GA distribution shows it has the class:

                                  public org.hibernate.annotations.common.reflection.ReflectionManager getReflectionManager();

                                  which is reported missing.
                                  So you must have something wrong with the classpath.

                                  Adam

                                  1 2 Previous Next