Configuring Hibernate service
joydeep May 3, 2004 6:10 AMHi,
I've configured Hibernate service for one of my application. My jboss-service.xml in the sar file looks like following:
jboss.jca:service=RARDeployer
com/edhand/example1/Order.hbm.xml,com/edhand/example1/Item.hbm.xml
java:/hibertest
java:/example1DS
net.sf.hibernate.dialect.HSQLDialect
true
false
UserTransaction
net.sf.hibernate.transaction.JTATransactionFactory
net.sf.hibernate.transaction.JBossTransactionManagerLookup
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 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