Atomikos Forum |
|
I'm trying to get Atomikos setup for the first time and have hit a hurdle that I can't clear. I'm using Hibernate 3.5.5 and Spring 2.5, within Tomcat. JDK 1.6 on OSX. Everything appears to bootstrap fine until Hibernate tries to validate the connection and I get this:
WARNING: Error delegating 'createClob' call java.lang.AbstractMethodError: oracle.jdbc.driver.LogicalConnection.createClob()Ljava/sql/Clob; 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:597) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:125) at $Proxy66.createClob(Unknown Source) 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:597) at org.hibernate.engine.jdbc.JdbcSupportLoader.useContextualLobCreation(JdbcSupportLoader.java:97) at org.hibernate.engine.jdbc.JdbcSupportLoader.loadJdbcSupport(JdbcSupportLoader.java:52) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:121) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:891) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225) I'm using com.atomikos.jdbc.AtomikosDataSourceBean, with oracle.jdbc.xa.client.OracleXADataSource. From debugging the connection looks like its there, wrapped and OK, until the createCLOB method is invoked on the proxy. I did have to do one workaround to exclude the Atomikos hibernate jars as they were causing a ClassDefinitionIncompatible Exception. So I basically just copied out the transaction manager lookup code into my own class and specified that for Hibernate to use. That's the only thing out of the ordinary I did thats different than the samples. Also I've wired up all the transaction managers in Spring as opposed to via Tomcat: <bean id="AtomikosTxManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown" value="false"/> </bean> <bean id="AtomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout" value="300"/> </bean> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="AtomikosTxManager"/> <property name="userTransaction" ref="AtomikosUserTransaction"/> </bean> Any ideas what could be causing this? Any pointers would be appreciated.
Thanks. Yes that has nudged me closer. It looks like in Hibernate's source they detect that this is JDK 1.6, so they test the waters to see if the driver implements JDBC4 LOB methods. Because this is Oracle 10.2.0.4(not 11+) the driver does not implement these methods. Which isn't a big deal from the Hibernate perspective, they just go about CLOBs a different non standard way. But this failed invocation seems to poison the Atomikos proxy connection as after:
WARNING: Error delegating 'createClob' call java.lang.AbstractMethodError: oracle.jdbc.driver.LogicalConnection.createClob()Ljava/sql/Clob; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) I then get: WARNING: atomikos connection pool 'XaDS': error creating proxy of connection an AtomikosXAPooledConnection with a SessionHandleState with 0 context(s) com.atomikos.datasource.pool.CreateConnectionException: an AtomikosXAPooledConnection with a SessionHandleState with 0 context(s): connection is erroneous at com.atomikos.jdbc.AtomikosXAPooledConnection.testUnderlyingConnection(AtomikosXAPooledConnection.java:89) at com.atomikos.datasource.pool.AbstractXPooledConnection.createConnectionProxy(AbstractXPooledConnection.java:43) at com.atomikos.datasource.pool.ConnectionPool.borrowConnection(ConnectionPool.java:135) at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:289) at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:341) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:381) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:427) at I'm guessing these might just be unrelated errors, and that the second is occurring because a transaction is not in progress when invoking jdbctemplate using the Atomikos XA datasource. So back to tinkering on my end of things. Thanks for the nudge. |