gpt4 book ai didi

java - 在 Java EE 服务器中打包 EJB

转载 作者:行者123 更新时间:2023-11-29 08:16:23 24 4
gpt4 key购买 nike

我已经将 EAR 中的企业应用程序和 WAR 中的独立 Web 应用程序(EAR 外部)部署到同一个 Java EE 服务器。

问题是我可以从独立 WAR 访问 EAR 中 session bean 的本地接口(interface)吗?如果可以,我可以使用依赖注入(inject) (DI) 吗?

最佳答案

EJB 3.1 规范的第 3.2.2 节明确指出这是不可移植的:

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.

一般来说,该解决方案至少需要:

  1. 允许 EAR 和 WAR 类加载器对同一接口(interface)类具有可见性的一些机制。
  2. 从另一个应用程序查找本地接口(interface)的一些机制。例如,java:global。

关于java - 在 Java EE 服务器中打包 EJB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4571847/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com