EJB3 - using 2 persistence units within a transaction (Exception: Local transaction already has 1 non-XA Resource)

前端 未结 2 1434
我在风中等你
我在风中等你 2021-02-08 16:44

I am trying to use 2 persistence units within the same transaction in a Java EE application deployed on Glassfish.

The 2 persistence units are defined in persistence.xml

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-08 17:27

    In order to use two persistence units (and thus two datasources) within a transaction, you need indeed to use XA connections and to configure your pools accordingly (at least one of them, GlassFish supports the last agent optimization that allows to enlist one non XA resource, see http://docs.sun.com/app/docs/doc/820-7695/beanm?a=view). That was for the first error.

    For the second error, it seems hard to say anything with the current level of details. Could you provide the stack trace (activate finer logging if required)?

提交回复
热议问题