将JTA集成到Java SE应用程序中需要做什么? [英] What do I need to do to integrate JTA into a Java SE application?

查看:155
本文介绍了将JTA集成到Java SE应用程序中需要做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想实现一个应用程序容器。不是完整的Java EE堆栈,但我需要提供对第三方代码的JDBC资源和事务的访问权限,这些代码将部署在我正在编写的应用程序中。

Suppose I want to implement an application container. Not a full-on Java EE stack, but I need to provide access to JDBC resources and transactions to third party code that will be deployed in an application I'm writing.

进一步说,我正在研究JBossTS的交易。我并不满足于此,但据我所知,它似乎最适合我需要做的事情。

Suppose, further, that I'm looking at JBossTS for transactions. I'm not settled on it, but it seems to be the best fit for what I need to do, as far as I can tell.

如何整合支持连接资源和JTA事务提供到我的Java SE应用程序中?

How do I integrate support for providing connection resources and JTA transactions into my Java SE application?

推荐答案

我选择了使用Bitronix事务管理器来解决这个问题,虽然显然至少有一个其他选项在我看来并不明显(Atomikos)。

I've elected to use the Bitronix Transaction Manager to solve this problem, although apparently there's at least one other option that wasn't apparent to me at the time (Atomikos).

解决这个问题已经结束我还要求我使用Tomcat进程内JNDI提供程序,以便将事务与JNDI名称相关联。由于该提供程序的限制,我无法使用JTA UserTransaction的默认名称,这在文档中并不是很明显。

Solving this ended up requiring me to use the Tomcat in-process JNDI provider as well, in order to associate the transaction with a JNDI name. Due to a limitation of that provider, I could not use the default name for a JTA UserTransaction, which isn't immediately apparent from the documentation.

感谢所有人无论如何都是有用的答案!

Thanks to all for the helpful answers anyhow!

这篇关于将JTA集成到Java SE应用程序中需要做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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