Joined: Mon May 03, 2004 7:10 am Posts: 4 Location: Bangalore, India
|
Hi,
I've configured Hibernate service for one of my J2EE application on JBOSS. My jboss-service.xml in the sar file looks like following:
<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=Hibernate">
<depends>jboss.jca:service=RARDeployer</depends>
<attribute name="MapResources">com/edhand/example1/Order.hbm.xml,com/edhand/example1/Item.hbm.xml</attribute>
<attribute name="JndiName">java:/hibertest</attribute>
<attribute name="Datasource">java:/example1DS</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.HSQLDialect</attribute>
<attribute name="UseOuterJoin">true</attribute>
<attribute name="ShowSql">false</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
</mbean>
</server>
Hibernate is configured to use default UserTransaction of jboss. I'm getting the following exception at JTATransaction.begin() method:
java.lang.ClassCastException: org.jboss.tm.usertx.client.ServerVMClientUserTransaction
at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:132)
at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:58)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2195)
at com.edhand.example1.ItemService.addItem(Unknown Source)
at com.edhand.example1.ItemServicesEJB.addItem(ItemServicesEJB.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:297)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
The return type of the begin() method is javax.transaction.UserTransaction
I've checked that the returned class org.jboss.tm.usertx.client.ServerVMClientUserTransaction implements javax.transaction.UserTransaction, hence is fully compatible with it. I'm at a loss to understand the reason for the ClassCastException. The class javax.transaction.UserTransaction is present in jboss-j2ee.jar and is loaded by the server.
Please help!!
Thanks,
Joydeep
|
|