[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - jboss-4.0.4.GA JPA Persistence.xml JTA UserTransaction Sprin
brobertarch
do-not-reply at jboss.com
Fri Oct 13 10:16:07 EDT 2006
Let see if I can explain this:
Description:
I am using JBoss+JPA[Java Persistence API]+Hibernate as Persistence Manager [don't know TopLink Essentials yet]+Spring2.0+JDK1.5+Tapestry4.1[Ajax]/Hivemind+maven2+cargo
Problem:
I'd like to use JTA instead of RESOURCE_LOCAL
I had to add java:comp/UserTransaction in conf/jboss-service.xml since it doesn't appear to be there
Finally, it doesn't seem to find the UserTransaction java.lang.ClassCastException: org.jboss.tm.TxManager
Somebody any clue?
ps: I tried the same conf on WebSphere 6.1 [IBM's JDK 1.5] using the below conf it works. Am I missing something?
| <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" />
| <property name="jta.UserTransaction" value="jta/usertransaction" />
|
persistence.xml
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| <persistence-unit name="BatchPostingStatusService" transaction-type="JTA">
| <jta-data-source>java:jdbc/raaDS</jta-data-source>
| <class>com.alliancebernstein.cfs.raa.domain.entity.persistence.JpaBatchPostingStatus</class>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
| <property name="jta.UserTransaction" value="java:comp/UserTransaction" />
| </properties>
| </persistence-unit>
| </persistence>
|
java:comp/UserTransaction in conf/jboss-service.xml
<!--
| | UserTransaction support.
| -->
| <mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"
| name="jboss:service=ClientUserTransaction"
| xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">
| <depends>
| <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
| name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">
| <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
| <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
| <attribute name="JndiName">UserTransactionSessionFactory</attribute>
| <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory</attribute>
| <attribute name="ClientInterceptors">
| <interceptors>
| <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
| <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
| </interceptors>
| </attribute>
| <depends>jboss:service=invoker,type=jrmp</depends>
| </mbean>
| </depends>
| <depends optional-attribute-name="TxProxyName">
| <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
| name="jboss:service=proxyFactory,target=ClientUserTransaction">
| <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
| <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
| <attribute name="JndiName">java:comp/UserTransaction</attribute>
| <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSession</attribute>
| <attribute name="ClientInterceptors">
| <interceptors>
| <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
| <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
| </interceptors>
| </attribute>
| <depends>jboss:service=invoker,type=jrmp</depends>
| </mbean>
| </depends>
| </mbean>
|
anonymous wrote : 2006-10-13 09:17:06,020 DEBUG [org.hibernate.impl.SessionFactoryImpl] obtaining JTA TransactionManager
| 2006-10-13 09:17:06,020 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
| 2006-10-13 09:17:06,020 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [entityManagerFactory,batchPostingStatusServiceDao,transactionManager,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor]; root of BeanFactory hierarchy}
| 2006-10-13 09:17:06,020 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
| org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.jboss.tm.TxManager
| Caused by:
| java.lang.ClassCastException: org.jboss.tm.TxManager
| at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978154#3978154
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978154
More information about the jboss-user
mailing list