发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 大数据 扩展性 并发编程 事件驱动 分布式 SOA

weblogic XA 事务配置问题

2004-12-30 17:36
赞助商链接

环境: weblogic 8.1
DB: oralce 9.02
使用hibernate 配合jndi
当在控制台中选择
oracle.jdbc.xa.client.OracleXADataSource 驱动程序以支持XA
结果启动应用 出现错误


51964 [ExecuteThread: '13' for queue: 'weblogic.kernel.Default'] ERROR net.sf.hibernate.util.JDBCExc
eptionReporter(38) - SQLException occurred
java.sql.SQLException: SQL operations are not allowed with no global transaction by default for XA d
rivers. If the XA driver supports performing SQL operations with no global transaction, explicitly a
llow it by setting "SupportsLocalTransaction" JDBC connection pool property to true. In this case, a
lso remember to complete the local transaction before using the connection again for global transact
ion, else a XAER_OUTSIDE XAException may result. To complete a local transaction, you can either set
auto commit to true or call Connection.commit() or Connection.rollback().
at weblogic.jdbc.wrapper.JTAConnection.checkIfLocalTxSupported(JTAConnection.java:85)
at weblogic.jdbc.wrapper.JTAConnection.checkConnection(JTAConnection.java:74)
at weblogic.jdbc.wrapper.Connection.prepareStatement(Connection.java:316)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:257)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:232)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3613)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)



如果配置 允许本地事务 则

ceptionReporter(46) - XA error: XAER_PROTO : Routine was invoked in an inproper context start() fail
ed on resource 'MyJDBC Connection Pool-1': XAER_PROTO : Routine was invoked in an inproper context
javax.transaction.xa.XAException
at oracle.jdbc.xa.OracleXAResource.disallowLocalTxnMode(OracleXAResource.java:1047)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:153)



139540 [ExecuteThread: '13' for queue: 'weblogic.kernel.Default'] ERROR net.sf.hibernate.util.JDBCEx
ceptionReporter(38) - Could not execute query
java.sql.SQLException: SQL operations are not allowed with no global transaction by default for XA d
rivers. If the XA driver supports performing SQL operations with no global transaction, explicitly a
llow it by setting "SupportsLocalTransaction" JDBC connection pool property to true. In this case, a
lso remember to complete the local transaction before using the connection again for global transact
ion, else a XAER_OUTSIDE XAException may result. To complete a local transaction, you can either set
auto commit to true or call Connection.commit() or Connection.rollback().

2004-12-31 10:44

你程序是非ejb的吧?使用xa数据原,应该把程序放在事务内,比如:
UserTransaction ut = ....
ut.begin();
myoperations....
ut.commit()

2004-12-31 11:13

是ejb{sessionbean} 采用的是容器管理事务

2004-12-31 14:34

你是用hibernate作为数据访问层的啊,倒没注意。我没有试过session bean+hibernate的实际操作,但从抱错来看,应该是你使用hibernate的程序没有放到事务里了。

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系管理员 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com