[JBoss jBPM] - Re: JbpmContext: when to create new vs. get current
by brado
Jean,
Yes, that helps -- thanks for the reply. However, it still doesn't answer the big question which is whether JbpmContext is reentrant or not. If it is not reentrant, then I want to know what the purpose of the JbpmConfiguration.getCurrentContext() method is. If JbpmConfiguration is reentrant, which the documentation says it is, then there's the possibility of two threads simultaneously invoking getCurrentContext(), and getting a reference to the same JbpmContext. Somehow this doesn't seem right if JbpmContext objects are tied to transactions. It would seem to me that JbpmContext objects should not be reentrant, but a single instance should be isolated to a single thread (or even more properly, a single caller). It strikes me that having a getCurrentContext() method on a reentrant JbpmConfiguration is a bug, or a design flaw, however you want to state it.
Can someone clarify the situation here? This is an issue that's fairly fundamental to use of jBPM.
Thanks,
Brad
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978158#3978158
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978158
19 years, 8 months
[Persistence, JBoss/CMP, Hibernate, Database] - jboss-4.0.4.GA JPA Persistence.xml JTA UserTransaction Sprin
by brobertarch
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
19 years, 8 months