Atomikos实现分布式事务异常小结

 

2015-11-08 02:47:22:WARN main atomikos - ERROR IN RECOVERY
com.atomikos.datasource.ResourceException: Error in recovery
	at com.atomikos.datasource.xa.XATransactionalResource.recover(XATransactionalResource.java:596)
	at com.atomikos.datasource.xa.XATransactionalResource.endRecovery(XATransactionalResource.java:670)
	at com.atomikos.icatch.imp.TransactionServiceImp.recover(TransactionServiceImp.java:635)
	at com.atomikos.icatch.imp.TransactionServiceImp.init(TransactionServiceImp.java:741)
	at com.atomikos.icatch.imp.BaseTransactionManager.init(BaseTransactionManager.java:217)
	at com.atomikos.icatch.standalone.StandAloneTransactionManager.init(StandAloneTransactionManager.java:104)
	at com.atomikos.icatch.standalone.UserTransactionServiceImp.init(UserTransactionServiceImp.java:307)
	at com.atomikos.icatch.config.UserTransactionServiceImp.init(UserTransactionServiceImp.java:413)
	at com.atomikos.icatch.jta.UserTransactionManager.checkSetup(UserTransactionManager.java:90)
	at com.atomikos.icatch.jta.UserTransactionManager.init(UserTransactionManager.java:140)
	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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod

 

 

 

解决方案:将数据源AtomikosDataSourceBean替换成AtomikosNonXADataSourceBean。

 

如:

<bean id="oracleDS" class="com.atomikos.jdbc.AtomikosDataSourceBean"
		init-method="init" destroy-method="close">
		<description>oracle xa datasource</description>
		<property name="uniqueResourceName">
			<value>oracle_ds</value>
		</property>
		<property name="xaDataSourceClassName">
			<value>oracle.jdbc.xa.client.OracleXADataSource</value>
		</property>
		<property name="xaProperties">
			<props>
				<prop key="user">${oracle.connection.username}</prop>
				<prop key="password">${oracle.connection.password}</prop>
				<prop key="URL">${oracle.connection.url}</prop>
			</props>
		</property>
		<property name="testQuery" value="select 1 from dual" />
		<property name="poolSize" value="3"/> 
	</bean>

 

 

替换成:

 

 

<bean id="oracleDS" class="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean" init-method="init"
		destroy-method="close" p:uniqueResourceName="oracle_ds" p:testQuery="select 1 from dual ">
		<property name="driverClassName" value="${oracle.connection.driverClass}" />
		<property name="url" value="${oracle.connection.url}" />
		<property name="user" value="${oracle.connection.username}" />
		<property name="password" value="${oracle.connection.password}" />
		<property name="poolSize" value="5" />
		<property name="maxPoolSize" value="30" />
	</bean>

 

 

 

2015-11-08 10:18:57:WARN main atomikos - Error delegating 'createClob' call
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.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.nonxa.AtomikosThreadLocalConnection.invoke(AtomikosThreadLocalConnection.java:306)
	at $Proxy30.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:118)
	at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:793)
	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:715)
	at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:189)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods
2015-11-08 10:18:57:INFO main org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as createClob() method threw error 

: java.lang.reflect.InvocationTargetException
2015-11-08 10:18:57:INFO main org.hibernate.cfg.SettingsFactory - Database ->
       name : Oracle

 

 解决方案:

 在SessionFacory配置中,加入

<prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>

 

 

 

 

 

你可能感兴趣的:(error,error,call,异常,in,atomikos,recovery,delegating,'createClob')