Erro no Spring ao fazer lookup de um DataSource

0 respostas
Mavericks

Estou usando JBoss 6.0, Spring, Hibernate + JPA

Criei o DataSource através desse mapeamento

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>LogDS</jndi-name>
    <connection-url>jdbc:oracle:thin:@//xprt_virtual:1521/xe</connection-url>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <user-name>XXXt</user-name>
    <password>XXX</password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      <metadata>
         <type-mapping>Oracle11g</type-mapping>
      </metadata>
  </local-tx-datasource>
</datasources>
Fiz o mapeamento no persistence.xml
<persistence-unit name="Log" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/LogDS</jta-data-source>
      
		<class>com.xxx.vo.IntegrationLog</class>
      	 
      <properties>
		<property name="jboss.entity.manager.jndi.name" value="java:/Log"/>		
		<property name="jboss.entity.manager.factory.jndi.name" value="java:/LogPUFactory" />
         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
         <property name="hibernate.show_sql" value="false"/>
         <property name="transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
       	 <property name="transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
      </properties>
   </persistence-unit>

E também o mapeamento do Spring

<jee:jndi-lookup id="entityManagerFactory" jndi-name="java:/CorePUFactory" expected-type="javax.persistence.EntityManagerFactory"/>
        <jee:jndi-lookup id="entityManagerFactoryLog" jndi-name="java:/LogPUFactory" expected-type="javax.persistence.EntityManagerFactory"/>    

      <context:annotation-config />
    
      <bean id="transactionManager-01" class="org.hibernate.transaction.JBossTransactionManagerLookup">
            <property name="transactionManager" ref="entityManagerFactory"/>
      </bean>
    
      <bean id="transactionManager-02" class="org.hibernate.transaction.JBossTransactionManagerLookup">
            <property name="transactionManager" ref="entityManagerFactoryLog"/>
      </bean>    
    
      <tx:annotation-driven transaction-manager="transactionManager"/>


    <mvc:annotation-driven />

Já existia um DataSource que está funcionando perfeitamente, agora ao tentar incluir o segundo, estou com o seguinte erro:

16:45:23,186 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager-01' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManager' of bean class [org.hibernate.transaction.JBossTransactionManagerLookup]: Bean property 'transactionManager' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Criado 29 de janeiro de 2013
Respostas 0
Participantes 1