当我想要将 EJB 公开给同一应用程序服务器上的不同应用程序时,是否需要使用 @Remote?

发布于 2024-09-28 03:18:59 字数 212 浏览 2 评论 0原文

我有一个 @Stateless @Local Bean 已成功部署在耳朵中。当我浏览 JNDI 树时,我可以看到新的 EJB 3.1 标准全局 JNDI 名称。 (java:global/product/product-ejb/ProductManagement)

我想在同一应用程序服务器上的不同应用程序中使用此EJB。我需要为此 EJB 添加远程接口吗?

I have a @Stateless @Local Bean successfully deployed in an ear. I can see the new EJB 3.1 standard global JNDI name when I browse the JNDI tree. (java:global/product/product-ejb/ProductManagement)

I want to use this EJB in a different application on the same app server. Do I need to add a remote interface for this EJB?

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

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

发布评论

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

评论(1

昨迟人 2024-10-05 03:18:59

规范不要求应用程序间访问本地客户端视图,但您的容器可能会选择支持。如果你希望你的应用程序是可移植的,你不应该依赖它并使用远程接口(一个像样的容器应该优化同一 JVM 内的调用)。来自 EJB 3.1 规范:

3.2.2 本地客户端

会话 bean 可能有本地客户端。
本地客户端是指
并置在同一个 JVM 中
提供本地会话bean
客户视图,这可能是紧密的
耦合到bean。本地客户
会话 bean 可能是另一个
企业 bean 或 Web 组件。

通过以下方式访问企业 Bean
本地客户端视图需要
两者在同一个 JVM 中的搭配
本地客户和企业
提供本地客户端的bean
看法。因此本地客户端视图
不提供位置
远程提供的透明度
客户视图。

通过以下方式访问企业 Bean
仅需要本地客户端视图
为本地客户提供支持
打包在同一个应用程序中
作为提供的企业 bean
本地客户端视图。合规
本规范的实现
可以选择支持访问
企业的本地客户视图
来自本地客户端的 bean 打包在
不同的应用程序。这
配置要求
应用程序间访问本地
客户端视图是特定于供应商的并且
不在此范围之内
规格。应用程序依赖
应用程序间访问本地
客户端视图是不可移植的。

...

参考

  • EJB 3.1 规范
    • 第 3.2.2 节“本地客户端”

Inter-application access to the local client view is not required by the specification but might be optionally supported by your container. If you want your application to be portable, you shouldn't rely on it and use a Remote interface (a decent container should optimize calls inside a same JVM anyway). From the EJB 3.1 specification:

3.2.2 Local Clients

Session beans may have local clients.
A local client is a client that is
collocated in the same JVM with the
session bean that provides the local
client view and which may be tightly
coupled to the bean. A local client of
a session bean may be another
enterprise bean or a web component.

Access to an enterprise bean through
the local client view requires the
collocation in the same JVM of both
the local client and the enterprise
bean that provides the local client
view. The local client view therefore
does not provide the location
transparency provided by the remote
client view.

Access to an enterprise bean through
the local client view is only required
to be supported for local clients
packaged within the same application
as the enterprise bean that provides
the local client view. Compliant
implementations of this specification
may optionally support access to the
local client view of an enterprise
bean from a local client packaged in a
different application
. The
configuration requirements for
inter-application access to the local
client view are vendor-specific and
are outside the scope of this
specification. Applications relying on
inter-application access to the local
client view are non-portable.

...

References

  • EJB 3.1 Specification
    • Section 3.2.2 "Local Clients"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文