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/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd

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

  http://www.springframework.org/schema/txhttp://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>

FacebookTwitterLinkedin
Pin It
Joomla Tutorials for Beginners