ejb3-在事务内使用 2-持久性单元

发布于 2024-09-16 23:56:54 字数 610 浏览 4 评论 0原文

我在使用以下技术堆栈从同一事务中连接到 2 个持久性单元时遇到问题,

WLS 10.3.x、Eclipselink 2.1、Oracle 11g JDBC 驱动程序、Informix 10 JDBC 驱动程序

使用此 SO 的输入post 我使 Oracle 数据源 XA 兼容和 Informix ds“模拟两阶段提交”,一切开始工作。但是,现在我遇到了一个奇怪的问题。

我使用独立的 java 客户端来调用 ejb 3 SLSB,而 ejb 3 SLSB 又调用 JPA 实体。我面临的问题是它第一次工作,第二次它不抛出任何异常,但不更新任一数据库中的数据,第三次它抛出一个异常,指出“事务已提交”,就好像应用程序一样服务器 JTA 事务管理器保留原始事务上下文。请注意,这 3 个调用是独立且连续的,其中每次调用都随着客户端退出客户端进程而完成。该问题非常一致,并且每次重新启动应用程序服务器时都会以完全相同的顺序发生。

感谢任何意见!

I am having problems connecting to 2 persistence units from within the same transaction using following tech stack,

WLS 10.3.x, Eclipselink 2.1, Oracle 11g JDBC driver, Informix 10 JDBC driver

Using inputs from this SO post I made the oracle datasource XA compliant and the Informix ds "Emulate 2-phase commit" and things started to work. However, now I am getting a strange problem.

I am using standalone java client to invoke my ejb 3 SLSB which in turn invokes the JPA entities. The problem I am facing is it works the first time, the second time it does not throw any exception but does not update the data in either databases and the 3rd time it throws an exception stating "Transaction has already been committed" as if the application server JTA transaction manager is holding on to the original transaction context. Please note these 3 invocations are separate and sequential wherein every invocations completes with the client exiting the client process. The problem is very consistent and happens in the exact same sequence every time I restart the app server.

Appreciate any input!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失与倦" 2024-09-23 23:56:54
<persistence-unit name="TopLinkDB" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/oracleDS</jta-data-source>
    <class>com.home.domain.Property</class>
    <properties>
        <property name="eclipselink.target-server" value="WebLogic_10" />
    </properties>
</persistence-unit>     
<persistence-unit name="TopLinkINFO" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/infoDS</jta-data-source>
    <class>com.home.domain.GlobalNumber</class>
    <properties>
        <property name="eclipselink.target-server" value="WebLogic_10" />
    </properties>
</persistence-unit>
<persistence-unit name="TopLinkDB" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/oracleDS</jta-data-source>
    <class>com.home.domain.Property</class>
    <properties>
        <property name="eclipselink.target-server" value="WebLogic_10" />
    </properties>
</persistence-unit>     
<persistence-unit name="TopLinkINFO" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/infoDS</jta-data-source>
    <class>com.home.domain.GlobalNumber</class>
    <properties>
        <property name="eclipselink.target-server" value="WebLogic_10" />
    </properties>
</persistence-unit>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文