Error retrieving connections in jboss to multiple databases even though there is no transaction

后端 未结 2 1604
天涯浪人
天涯浪人 2021-01-01 21:45

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 data

2条回答
  •  北海茫月
    2021-01-01 21:57

    Two suggestions:

    1. Consider updating the datasources to their XA equivalents. This will solve all your problems. I suspect you are hindered here?
    2. Consider setting com.arjuna.ats.arjuna.allowMultipleLastResources to true in the server conf. This will allow the behaviour you want, but unfortunately for the whole app, not just the method.

    Update:

    I don't recommend enabling multiple one-phase resources since it weakens the transactional properties of you app substantially. But if you want to do this in JBoss 7 you need to modify standalone.xml and add:

    
            
    
    

    You now have a system which is not far away from one without transactions. What it will still do though, is to warn you if you get heuristic outcomes.

    My recommendation is still to use XA datasources if you can.

    Update 2:

    Oh, and if someone comes along to read this I want to add that if you can divide your code into different methods, unlike the OP, I would recommend restructuring your code and use @TransactionAttribute(REQUIRES_NEW) to create parallel transactions. This is better than turning on multiple 1PC, albeit not as good as turning on XA.

提交回复
热议问题