Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' Userserviceimpl ': injection of Persistence fields failed; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Entitymanagerfactory ' defined in class path resource [Applicationcontext.xml]: Invocation of Init method failed; Nested exception is java.lang.IllegalArgumentException:No persistenceprovider specified in Entitymanagerfactory Configuration, and chosen Persistenceunitinfo does not specify a provider class name either
At Org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessAfterInstantiation ( persistenceannotationbeanpostprocessor.java:311)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:959)
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.context.support.classpathxmlapplicationcontext.<init> ( classpathxmlapplicationcontext.java:139)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( CLASSPATHXMLAPPLICATIONCONTEXT.JAVA:83)
At Com.test.FirstTest.springToJPATest (firsttest.java:69)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:39)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:25)
At Java.lang.reflect.Method.invoke (method.java:597)
At Org.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:44)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:15)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:41)
At Org.junit.internal.runners.statements.InvokeMethod.evaluate (invokemethod.java:20)
At Org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored (blockjunit4classrunner.java:79)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:71)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:49)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:193)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:52)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:191)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:42)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:184)
At Org.junit.runners.ParentRunner.run (parentrunner.java:236)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:50)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197)
caused by: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.IllegalArgumentException:No persistenceprovider specified in Entitymanagerfactory Configuration, and chosen Persistenceunitinfo does not specify a provider class name either
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1337)
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: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.getBeansOfType ( defaultlistablebeanfactory.java:308)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType ( defaultlistablebeanfactory.java:297)
At Org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors (beanfactoryutils.java:224)
At Org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory ( persistenceannotationbeanpostprocessor.java:503)
At Org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory ( persistenceannotationbeanpostprocessor.java:473)
At org.springframework.orm.jpa.support.persistenceannotationbeanpostprocessor$ Persistenceelement.resolveentitymanager (persistenceannotationbeanpostprocessor.java:598)
At org.springframework.orm.jpa.support.persistenceannotationbeanpostprocessor$ Persistenceelement.getresourcetoinject (persistenceannotationbeanpostprocessor.java:569)
At Org.springframework.beans.factory.annotation.injectionmetadata$injectedelement.inject (InjectionMetadata.java : 180)
At Org.springframework.beans.factory.annotation.InjectionMetadata.injectFields (injectionmetadata.java:105)
At Org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessAfterInstantiation ( persistenceannotationbeanpostprocessor.java:308)
... More
caused By:java.lang.IllegalArgumentException:No persistenceprovider specified in Entitymanagerfactory configuration, and chosen Persistenceunitinfo does not specify a provider class name either
At Org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory ( localcontainerentitymanagerfactorybean.java:207)
At Org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet ( abstractentitymanagerfactorybean.java:291)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1368)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1334)
... More
Workaround, add the provider configuration to the Persistence.xml:
Chosen Persistenceunitinfo does not specify a provider class name