EJB3本地和远程接口 [英] EJB3 Local and Remote interfaces

查看:126
本文介绍了EJB3本地和远程接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Local接口是为同一容器的JVM实例中的客户端设计的,远程接口是为驻留在EJB容器的JVM外部的客户端设计的。如果Web应用程序客户端不在同一个.ear中驻留(或打包)但位于同一Java EE服务器上,那该怎么办?

I understood that Local interface is designed for clients in the same container's JVM instance and remote interface is designed for clients residing outside the EJB container's JVM. How about the web application client which is not reside (or packaged) in the same .ear but reside on the same Java EE server?

推荐答案

正式 @Local 带注释的bean只有在他们'时才能被访问'在同一个应用程序中。与.ear(或其他.war或其他.jar EJB)分开部署的.war是一个不同的应用程序,即使部署到同一个应用程序服务器实例也是如此。

Officially @Local annotated beans can only be accessed if they're in the same application. A .war deployed separately from an .ear (or other .war or other .jar EJB) is a different application, even when deployed to the same application server instance.

因此,没有保证你的.war中的代码可以调用 @Local 在.ear中定义的EJB bean。

There's thus no guarantee that the code in your .war can call @Local EJB beans that are defined in the .ear.

然而,在几乎所有应用程序服务器的实践中,这都可行。

However, in practice in nearly all application servers this just works.

请求EJB 3.2规范正式支持本地跨应用程序调用: http://java.net/jira/browse/EJB_SPEC-22

There's a request for the EJB 3.2 spec to officially support local cross-application calls: http://java.net/jira/browse/EJB_SPEC-22

这篇关于EJB3本地和远程接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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