Spring, Hibernate and JBoss
jpount Jul 7, 2005 3:21 AMI have a small test application that uses Spring, Hibernate and connects to DB2.
Everything works fine when using WSAD + WebSphere and I am having trouble getting the same thing going in JBoss.
My two main problems are :
1. Using JTA
2. Configuring an XA datasource for DB2
JTA
In my spring config file I am using the following transaction related details .....
org.springframework.transaction.jta.JtaTransactionManager
transactionManagerName = java:/TransactionManager
OR
org.springframework.orm.hibernate3.HibernateTransactionManager
If I use the hibernate transaction manager everything is ok, but if I use the JTA entry then I get the following error ...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [testadmin-ctx.xml]: Initialization of bean failed; nested exception is org.springframework.transaction.TransactionSystemException: JTA TransactionManager is not available at JNDI location [java:/TransactionManager]; nested exception is javax.naming.NamingException: Object [org.jboss.tm.TxManager@69cfe0] available at JNDI location [java:/TransactionManager] does not implement [javax.transaction.TransactionManager]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:341)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)
If I look in the JBoss console I can see the TransactionManager in the java namespace under JNDI view so I guess it must be set up wrong or my spring config is wrong ...
+- TransactionManager (class: org.jboss.tm.TxManager)
XA Datasource
I can setup and read from the database if I copy the db2-ds.xml file and change it for my database. However if I use the db2-xa-ds.xml then I cannot get a connection. I am using the following driver ...
<xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
I've read through loads of posts and tried a number of configurations but still no joy. Can anyone help ?
Thanks,
John