[jboss-user] [Installation, Configuration & Deployment] - Unable to locate UserTransaction to check status
miro1234
do-not-reply at jboss.com
Mon Jul 17 15:08:48 EDT 2006
Hello,
I use org.jboss.hibernate.jmx.Hibernate MBean for my hibernate application with following deploy file:
| <mbean code="org.jboss.hibernate.jmx.Hibernate"
| name="jboss.har:service=Hibernate">
| <depends>jboss.jca:service=RARDeployer</depends>
| <depends>jboss.jca:service=LocalTxCM,name=DerbyDS</depends>
| <attribute name="SessionFactoryName">
| java:/hibernate/SessionFactory
| </attribute>
| <attribute name="DatasourceName">java:DerbyDS</attribute>
| <attribute name="Dialect">
| org.hibernate.dialect.DerbyDialect
| </attribute>
| <attribute name="CacheProviderClass">
| org.hibernate.cache.NoCacheProvider
| </attribute>
| <attribute name="ShowSqlEnabled">true</attribute>
| <!-- attribute name="ScanForMappingsEnabled">true</attribute-->
| </mbean>
|
I also deploy TransactionManager service via following deploy file:
| <?xml version="1.0" encoding="UTF-8"?>
| <server>
| <mbean code="org.jboss.tm.XidFactory"
| name="jboss:service=XidFactory">
| </mbean>
| <mbean code="org.jboss.tm.TransactionManagerService"
| name="jboss:service=TransactionManager">
| <attribute name="TransactionTimeout">300</attribute>
| <attribute name="GlobalIdsEnabled">true</attribute>
| <depends optional-attribute-name="XidFactory">
| jboss:service=XidFactory
| </depends>
| </mbean>
| </server>
|
In applications servlet, I'd like to obtain session and begin transaction on it:
| InitialContext ctx=new InitialContext();
| factory=(SessionFactory)ctx.lookup("java:/hibernate/SessionFactory");
| // session = factory.getCurrentSession();
| session=factory.openSession();
| session.getTransaction().begin();
|
But when calling factory.openSession(), I get
org.hibernate.TransactionException: Unable to locate UserTransaction to check status
I also tryed obtaining session by factory.getCurrentSession(), but I got org.hibernate.HibernateException: Unable to locate current JTA transaction
When using org.hibernate.jmx.HibernateService MBean instead of org.jboss.hibernate.jmx.Hibernate, previous problems do not appear. But using this approach, I have to map resources manually...
Any help is appreciated.
Miro
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958573#3958573
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958573
More information about the jboss-user
mailing list