将jboss中的连接检索到多个数据库时出错,即使没有事务也是如此 [英] Error retrieving connections in jboss to multiple databases even though there is no transaction

查看:298
本文介绍了将jboss中的连接检索到多个数据库时出错,即使没有事务也是如此的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在从JBoss 6升级到JBoss 7.我们的应用程序的性质是每个客户都有一个单独的数据库实例,以及所有客户共有的核心配置数据库。我们经常使用EJB代码,它至少会在一次调用中引用核心数据库和单个客户的数据,甚至是一些通过所有客户的一般后台流程。

We are in the process of upgrading from JBoss 6 to JBoss 7. The nature of our application has a separate database instance per customer, as well as a core configuration database common to all customers. We often have EJB code which will at least reference the core database plus the individual customer's data in one call, and even some general background processes that go through all customers.

In通过使用NOT_SUPPORTED事务属性设置方法,可以毫无问题地处理JBoss 6。但是,JBoss 7抱怨这个有以下错误:

In JBoss 6 this was handled without issue by setting the method with a NOT_SUPPORTED transaction attribute. However, JBoss 7 complains about this with the following error:


ARJUNA012140:不允许添加多个最后资源。尝试
添加
LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl @ 74bec54d [connectionListener = d3ce980
connectionManager = 25b47a05警告= false currentXid =< formatId = 131077,
gtrid_length = 29,bqual_length = 36,
tx_uid = 0:ffff0a2c28d1:-5a4c1f9a:504689c9:11,node_name = 1,
branch_uid = 0:ffff0a2c28d1:-5a4c1f9a:504689c9:14,
subordinatenodename = null,eis_name =未知的eis名称>])),但已经

LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl @ 518d0191 [connectionListener = 1a05d94a
connectionManager = 135f1cfe警告= false currentXid =< formatId = 131077,
gtrid_length = 29,bqual_length = 36,
tx_uid = 0:ffff0a2c28d1:-5a4c1f9a:504689c9:11,node_name = 1,
branch_uid = 0:ffff0a2c28d1:-5a4c1f9a:504689c9:13,
subordinatenodename = null,eis_name = unknown eis name>]))

ARJUNA012140: Adding multiple last resources is disallowed. Trying to add LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@74bec54d[connectionListener=d3ce980 connectionManager=25b47a05 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a2c28d1:-5a4c1f9a:504689c9:11, node_name=1, branch_uid=0:ffff0a2c28d1:-5a4c1f9a:504689c9:14, subordinatenodename=null, eis_name=unknown eis name >])), but already have LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@518d0191[connectionListener=1a05d94a connectionManager=135f1cfe warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a2c28d1:-5a4c1f9a:504689c9:11, node_name=1, branch_uid=0:ffff0a2c28d1:-5a4c1f9a:504689c9:13, subordinatenodename=null, eis_name=unknown eis name >]))

如果不将每个调用都包含在内,我们如何解决这个问题?分隔符中的不同数据库te EJB调用和事务。有没有办法在EJB调用或类似的东西中实际关闭JBoss事务管理?

How can we work around this problem without wrapping every call to the different databases in a separate EJB call and transaction. Is there a way to actually turn off the JBoss transaction management in an EJB call or something similar?

注意:这个问题在bounty启动后被修改了额外的发现,以突出对特定问题的关注,并删除被排除的其他可能性。

推荐答案

好的,它事实证明,与JBoss6不同,NOT_SUPPORTED事务仍然是一个事务,就检索数据源的验证逻辑而言。

OK, it turns out that unlike JBoss6, a NOT_SUPPORTED transaction is still a transaction as far as the validation logic for retrieving data sources is concerned.

解决这个问题的方法是制作整个EJB是一个bean管理的事务:

The way to work around this is to make the whole EJB a bean managed transaction:

@TransactionManagement(TransactionManagementType.BEAN)

这不幸地限制了一些灵活性,因为有时你宁愿控制这种方法,但是解决方法并不是太痛苦。

This unfortunately limits some flexibility in that some times you would rather control this method-by-method, but it isn't too painful a workaround.

这篇关于将jboss中的连接检索到多个数据库时出错,即使没有事务也是如此的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆