configurar el applicationContext.xml de spring
buenos dias, estoy iniciando un proyecto en spring mvc y cada vez que creo un bean nuevo me presenta error:
error creating bean with name 'entityManagerFactory' defined in class path resource [test-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: springappPU] Unable to build EntityManagerFactory
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [test-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: springappPU] Unable to build EntityManagerFactory.
mi applicationContext.xml es:
<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:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans <a href="http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
" title="http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
">http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
</a> <a href="http://www.springframework.org/schema/tx" title="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a> <a href="http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
" title="http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
</a> <a href="http://www.springframework.org/schema/context" title="http://www.springframework.org/schema/context">http://www.springframework.org/schema/context</a> <a href="http://www.springframework.org/schema/context/spring-context-3.0.xsd">
" title="http://www.springframework.org/schema/context/spring-context-3.0.xsd">
">http://www.springframework.org/schema/context/spring-context-3.0.xsd">
</a>
<!-- holding properties for database connectivity /-->
<!-- <context:property-placeholder location="classpath:jdbc.properties"/>-->
<!-- enabling annotation driven configuration /-->
<!-- <context:annotation-config/>-->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/scn"/>
<property name="username" value="root"/>
<property name="password" value=""/>
</bean>
<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>
<!-- <property name="hibernate.hbm2ddl.auto" value="update"/>-->
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="persistenceUnitName" value="springappPU"/>
</bean>
<bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:database="MYSQL"
p:showSql="TRUE" />
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
p:entityManagerFactory-ref="entityManagerFactory"/>
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- Scans the classpath of this application for @Components to deploy as beans -->
<context:component-scan base-package="com.companyname.springapp.repository" />
<context:component-scan base-package="com.companyname.springapp.service" />
</beans>
muchas gracias.
- Inicie sesión o regístrese para enviar comentarios
Comentarios recientes
hace 13 semanas 4 días
hace 1 año 25 semanas
hace 1 año 29 semanas
hace 1 año 36 semanas
hace 1 año 44 semanas
hace 1 año 47 semanas
hace 1 año 49 semanas
hace 2 años 1 día
hace 2 años 1 día
hace 2 años 6 semanas