Announcement Announcement Module
Collapse
No announcement yet.
Error:creating bean with name 'entityManagerFactory' defined in class path resource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error:creating bean with name 'entityManagerFactory' defined in class path resource

    Hello i'm trying to run an example and i'm getting the error:

    -----INITIALIZING APPLICATION----
    2008-12-12 16:56:10,906 INFO (org.hibernate.cfg.annotations.Version:15) - Hibernate Annotations 3.3.0.GA
    2008-12-12 16:56:10,921 INFO (org.hibernate.cfg.Environment:514) - Hibernate 3.2.5
    2008-12-12 16:56:10,921 INFO (org.hibernate.cfg.Environment:547) - hibernate.properties not found
    2008-12-12 16:56:10,921 INFO (org.hibernate.cfg.Environment:681) - Bytecode provider name : cglib
    2008-12-12 16:56:10,921 INFO (org.hibernate.cfg.Environment:598) - using JDK 1.4 java.sql.Timestamp handling
    2008-12-12 16:56:10,984 INFO (org.hibernate.ejb.Version:15) - Hibernate EntityManager 3.3.1.GA
    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named spedulerPU
    Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named spedulerPU
    at javax.persistence.Persistence.createEntityManagerF actory(Persistence.java:55)
    at org.springframework.orm.jpa.LocalEntityManagerFact oryBean.createNativeEntityManagerFactory(LocalEnti tyManagerFactoryBean.java:91)
    at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:251)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1198)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1167)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:427)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 49)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:155)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:246)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:160)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:285)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:122)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:66)
    at com.speduler.dao.impl.JPAmain.run(JPAmain.java:43)
    at com.speduler.dao.impl.JPAmain.main(JPAmain.java:58 )


    please suggest me how to resolve this issue,,

  • #2
    My Application Context and peristence.xmls are as follows

    persistence.xml:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <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="speduler26PU">
    		<provider>org.hibernate.ejb.HibernatePersistence</provider>
    		<class>com.speduler.model.data.Spadminuser</class>
    		
    		<properties>
    			<property name="hibernate.connection.driver_class"
    				value="oracle.jdbc.driver.OracleDriver" />
    			<property name="hibernate.connection.url"
    				value="jdbc:oracle:thin:@192.168.1.176:15210:ALIG" />
    			<property name="hibernate.connection.username"
    				value="scoot" />
    			<property name="hibernate.connection.password"
    				value="tiger" />
    			 <property name="hibernate.hbm2ddl.auto" 
    			 value="update"/>
    		</properties>
    	</persistence-unit>
    
    </persistence>
    Application Context.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    	xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    			http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
    			http://www.springframework.org/schema/tx 
    			http://www.springframework.org/schema/tx/spring-tx-2.0.xsd" 
    			xmlns:tx="http://www.springframework.org/schema/tx">
    
    
    
    	<bean id="entityManagerFactory"	class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    		<property name="persistenceUnitName" value="spedulerPU" />
    	</bean>
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    		<property name="entityManagerFactory" ref="entityManagerFactory" />
    	</bean>
    	
    	<tx:annotation-driven transaction-manager="transactionManager" />
    	
    	<bean id="SpadminuserDAO" class="com.speduler.dao.impl.SpadminuserDAOImpl">
    		<property name="entityManagerFactory" ref="entityManagerFactory" />
    	</bean>
    </beans>
    Please help me i'm new to spring.
    thankyou

    Comment


    • #3
      PU name here
      <property name="persistenceUnitName" value="spedulerPU" />

      and here

      <persistence-unit name="speduler26PU">

      must match.

      Comment

      Working...
      X