This discussion is archived
0 Replies Latest reply: Oct 4, 2012 7:54 PM by 964392 RSS

Getting seemingly applicationContext.xml based error.

964392 Newbie
Currently Being Moderated
I have been trying to integrate Jersey+Spring+JPA+Hibernate+Glassfish+MySQL. I find a tutorial with a source code at http://persistentdesigns.com/wp/jersey-spring-and-jpa/. After changing the server from Jetty to Glassfish, build the file and try to run (using Netbeans 7.2). I end up with the following error. I am including the error and the applicationContext.xml.

applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
     xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
     xsi:schemaLocation="
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
               http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
               http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
     <!-- Scan for both Jersey Rest Annotations a -->
<context:component-scan base-package="com.persistent.rest,com.persistent.service,com.persistent.service.jpa"/>
<context:annotation-config />
<tx:annotation-driven />
<bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource"
          p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/jpa"
          p:username="user" p:password="password" />

     <bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
          p:dataSource-ref="dataSource" p:jpaVendorAdapter-ref="jpaAdapter">
          <property name="loadTimeWeaver">
               <bean
                    class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
          </property>
     </bean>
     <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
          p:entityManagerFactory-ref="entityManagerFactory" />
     <bean id="jpaAdapter"
          class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
          p:database="MYSQL" p:showSql="true" />
</beans>



The Error:


SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService': Injection of persistence methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
     at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:324)
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:998)
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
     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:221)
     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.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
     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.contextListenerStart(StandardContext.java:4750)
     at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
     at org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
     at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
     at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
     at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
     at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
     at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
     at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
     at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
     at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
     at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
     at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
     at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
     at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
     at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
     at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
     at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
     at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
     at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
     at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
     at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
     at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
     at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
     at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
     at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
     at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
     at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
     at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
     at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
     at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
     at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
     at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
     ...

SEVERE: Exception while loading the app
SEVERE: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService': Injection of persistence methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;

Edited by: 961389 on Oct 4, 2012 7:54 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points