This content has been marked as final.
Show 1 reply
-
1. Re: Jboss 7 - Spring - using Jboss Entity-/TransactionManager
marvin182 Jan 10, 2013 7:25 AM (in response to marvin182)What I did so far:
persitence.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="my_pu" transaction-type="JTA"> <!--<provider>org.hibernate.ejb.HibernatePersistence</provider>--> <jta-data-source>java:jboss/datasources/my_ds</jta-data-source> <properties> <!--<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />--> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" /> <!-- <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" /> <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" /> --> <property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/myEntityManagerFactory" /> </properties> </persistence-unit> </persistence>
applicationContext.xml:
<!--<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="my_pu" /> </bean> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManagerName" value="java:/TransactionManager" /> </bean>--> <jee:jndi-lookup id="entityManagerFactory" jndi-name="java:jboss/myEntityManagerFactory" /> <!-- <tx:jta-transaction-manager/> --> <!-- JBoss --> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="${database.jndi.path}" /> </bean> <jee:jndi-lookup id="entityManagerFactory" jndi-name="java:jboss/myEntityManagerFactory" /> <!-- <tx:jta-transaction-manager/> --> <!-- JBoss --> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="${database.jndi.path}" /> </bean>
Stacktrace:
Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider] at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:190) at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:112) at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:54) at org.hibernate.service.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:69) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:177) ... 22 more Caused by: java.lang.ClassCastException: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:187) ... 26 more
problem with hibernate 3 which is within my .war and hibernate 4 from jboss?