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

标签 java jakarta-ee ejb

我已经将 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/

相关文章:

jakarta-ee - WELD-001408 在注入(inject)点带有限定符 [@Named] 的类型 [LdapService] 的依赖关系不满足

java - 是否可以将 EJB 与具有泛型类型绑定(bind)的类一起使用?

java - 从 XSL (SAXON) 调用 Java

jakarta-ee - Tomcat 是否有等同于 GlassFish "Alternate Document Roots"的东西?

java - 我如何处理/限制用户访问 servlet 和 jsp?

eclipse - 有没有办法将 JavaEE 项目配置为使用默认目标运行时运行?

java - 创建实体时数据库表中的空值

java - 如何在使用 GEF 为 Eclipse 插件生成的图形中获取定向箭头(用于边)?

java - sybase jdbc连接问题

java - 将 Google map 添加到 fragment