0 Replies Latest reply on Apr 18, 2007 12:17 AM by Suneet Shah

    Problem using Spring + JPA + Struts

    Suneet Shah Newbie

      ello,

      I am trying to integrate spring with hibernate with JPA into my struts application and am getting the exception below. The service classes, which are calling the jpa objects were tested with Junit and they worked fine so I am not sure what the cause of the problem is.

      Any assistance would be appreciated.

      I am using JBoss 4.05 + Hibernate 3.2.2 ga + Hibernate Annotation 3.3.0 +
      Hibernate entity Manager 3.3.1

      00:04:57,328 INFO [XmlWebApplicationContext] Bean 'dataSource' is not eligible
      for getting processed by all BeanPostProcessors (for example: not eligible for a
      uto-proxying)
      00:04:57,375 INFO [XmlWebApplicationContext] Bean 'org.springframework.orm.jpa.
      vendor.HibernateJpaVendorAdapter#7c9b46' is not eligible for getting processed b
      y all BeanPostProcessors (for example: not eligible for auto-proxying)
      00:04:58,515 INFO [Version] Hibernate Annotations 3.3.0.GA
      00:04:58,578 INFO [Environment] Hibernate 3.2.0.ga
      00:04:58,593 INFO [Environment] hibernate.properties not found
      00:04:58,593 INFO [Environment] Bytecode provider name : cglib
      00:04:58,609 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
      00:04:58,859 INFO [Version] Hibernate EntityManager 3.3.1.GA
      00:04:58,921 INFO [DefaultListableBeanFactory] Destroying singletons in org.spr
      ingframework.beans.factory.support.DefaultListableBeanFactory@1016505: defining
      beans [/authenticate,serviceManager,serviceDAO,userManager,userDAO,entityManager
      Factory,dataSource,transactionManager,org.springframework.aop.config.internalAut
      oProxyCreator,org.springframework.transaction.interceptor.TransactionAttributeSo
      urceAdvisor,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostPro
      cessor,org.springframework.dao.annotation.PersistenceExceptionTranslationPostPro
      cessor]; root of factory hierarchy
      00:04:58,921 ERROR [ContextLoaderPlugIn] Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean wit
      h name 'entityManagerFactory' defined in class path resource [META-INF/commonCon
      text.xml]: Invocation of init method failed; nested exception is java.lang.Illeg
      alAccessError: tried to access method org.hibernate.engine.CascadeStyle.<init>()
      V from class org.hibernate.engine.EJB3CascadeStyle$1
      Caused by:
      java.lang.IllegalAccessError: tried to access method org.hibernate.engine.Cascad
      eStyle.<init>()V from class org.hibernate.engine.EJB3CascadeStyle$1
       at org.hibernate.engine.EJB3CascadeStyle$1.<init>(EJB3CascadeStyle.java:
      24)
       at org.hibernate.engine.EJB3CascadeStyle.<clinit>(EJB3CascadeStyle.java:
      19)
       at org.hibernate.ejb.event.EJB3PersistEventListener.<clinit>(EJB3Persist
      EventListener.java:19)
       at org.hibernate.ejb.EventListenerConfigurator.<init>(EventListenerConfi
      gurator.java:80)
       at org.hibernate.ejb.Ejb3Configuration.<init>(Ejb3Configuration.java:132
      )
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
      ctory(HibernatePersistence.java:125)
       at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.cr
      eateNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:214)
       at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPro
      pertiesSet(AbstractEntityManagerFactoryBean.java:251)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1143)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1110)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.createBean(AbstractAutowireCapableBeanFactory.java:431)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
      ject(AbstractBeanFactory.java:254)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
      y.getSingleton(DefaultSingletonBeanRegistry.java:144)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
      (AbstractBeanFactory.java:251)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
      (AbstractBeanFactory.java:163)
       at org.springframework.dao.annotation.PersistenceExceptionTranslationPos
      tProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:104)
      
       at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1101)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.createBean(AbstractAutowireCapableBeanFactory.java:431)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
      ject(AbstractBeanFactory.java:254)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
      y.getSingleton(DefaultSingletonBeanRegistry.java:144)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
      (AbstractBeanFactory.java:251)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
      (AbstractBeanFactory.java:163)
       at org.springframework.context.support.AbstractApplicationContext.getBea
      n(AbstractApplicationContext.java:683)
       at org.springframework.context.support.AbstractApplicationContext.regist
      erBeanPostProcessors(AbstractApplicationContext.java:451)
       at org.springframework.context.support.AbstractApplicationContext.refres
      h(AbstractApplicationContext.java:337)
       at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicati
      onContext(ContextLoaderPlugIn.java:355)
       at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplication
      Context(ContextLoaderPlugIn.java:296)
       at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoader
      PlugIn.java:225)