Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

error creating bean with name 'entitymanagerfactory' defined in class path resource(applicationConte

1064493May 25 2014 — edited May 25 2014

i'm new in spring i use the xml file "applicationContext.xml" for doing the configuration of JPA with spring mvc there no errors but when i do the test with a jUnit class i have this error

error creating bean with name 'entitymanagerfactory' defined in class path resource(applicationContext.xml):invocation of init method failed;nested exception is javax.persistence.PersistenceException:(persistence unit :UP_BOUTIQUE) unable to build manager factory

that's my file application context.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:context="http://www.springframework.org/schema/context"

  xmlns:tx="http://www.springframework.org/schema/tx"

  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd

  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

<bean id="datasource"

class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>

<property name="url" value="jdbc:mysql://localhost:3306/eboutique"></property>

<property name="username" value="root"></property>

<property name="password" value=""></property>

</bean>

<bean id="persistenceUnitManager"

class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">

<property name="defaultDataSource" ref="datasource"> </property>

<property name="persistenceXmlLocations">

<list>

<value>classpath*:META-INF/persistence.xml</value>

</list>

</property>

</bean>

<bean id="entityManagerFactory"

class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

<property name="persistenceUnitManager" ref="persistenceUnitManager"></property>

<property name="persistenceUnitName" value="UP_BOUTIQUE"> </property>

</bean>

<bean id="transactionManager"

class="org.springframework.orm.jpa.JpaTransactionManager">

<property name="entityManagerFactory" ref="entityManagerFactory"></property>

</bean>

<tx:annotation-driven transaction-manager="transactionManager"/>

</beans>

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 22 2014
Added on May 25 2014
1 comment
5,630 views