Cannot resolve reference to bean 'txManager' while setting bean property 'transactionManager'

0 respostas
V

Pessoal se alguem puder ajudar … Muito Obrigado

Estou utilizando o spring e rodando com jboss 4.2.2.GA

Estou com o seguinte erro:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.transaction.interceptor.TransactionInterceptor#0’: Cannot resolve reference to bean ‘txManager’ while setting bean property ‘transactionManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘txManager’ defined in ServletContext resource [/WEB-INF/spring-config.xml]: Cannot resolve reference to bean ‘entityManagerFactory’ while setting bean property ‘entityManagerFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in ServletContext resource [/WEB-INF/spring-config.xml]: Cannot create inner bean ‘org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#4ef523’ of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property ‘jpaVendorAdapter’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#4ef523’ defined in ServletContext resource [/WEB-INF/spring-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.springframework.orm.jpa.vendor.Database] for property ‘database’; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.springframework.orm.jpa.vendor.Database] for property ‘database’: no matching editors or conversion strategy found

O meu arquivo spring-config.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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation=“http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd”>

&lt;tx:annotation-driven transaction-manager="txManager" /&gt;

&lt;context:annotation-config /&gt;

&lt;context:component-scan base-package="br.com.jfrj.sigaFrancope" /&gt;



&lt;!-- Fabrica de entity managers --&gt;
&lt;bean id="entityManagerFactory"
	class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
	&lt;property name="dataSource" ref="myDataSource" /&gt;
	&lt;property name="jpaVendorAdapter"&gt;
		&lt;bean
			class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
			&lt;property name="showSql" value="${jpa.show.sql}" /&gt;
			&lt;property name="generateDdl"
				value="${jpa.generate.ddl}" /&gt;
			&lt;property name="database" value="${jpa.database}" /&gt;
		&lt;/bean&gt;
	&lt;/property&gt;
	&lt;property name="jpaProperties"&gt;
		&lt;props&gt;
			&lt;prop key="hibernate.dialect"&gt;${jpa.dialect}&lt;/prop&gt;
		&lt;/props&gt;
	&lt;/property&gt;
	
&lt;/bean&gt;

&lt;!-- Gerenciador de transacoes baseado em JPA --&gt;
&lt;bean id="txManager"
	class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
	&lt;property name="entityManagerFactory"
		ref="entityManagerFactory" /&gt;
&lt;/bean&gt;

&lt;context:property-placeholder
	location="/WEB-INF/database.properties" /&gt;

&lt;bean id="myDataSource"
	class="org.apache.commons.dbcp.BasicDataSource"
	destroy-method="close"&gt;
	&lt;property name="driverClassName" value="${db.driverClassName}" /&gt;
	&lt;property name="url" value="${db.url}" /&gt;
	&lt;property name="username" value="${db.username}" /&gt;
	&lt;property name="password" value="${db.password}" /&gt;
&lt;/bean&gt;

</beans>

Criado 13 de maio de 2009
Respostas 0
Participantes 1