EJB、WebService结合JNI场景

EJB, WebService combined with JNI scenario

我正在处理一个项目,我必须决定以组合方式使用 EJB、Web 服务或 EJB 与 @WebService。我是 Java EE 的新手,我喜欢 EJB 的概念,但我还想为非 java 系统提供一种使用此服务的方法。以下是有关主要组件的事实:

计划是在 EJB 中实现所有这些组件,但本机库的问题让我感到困惑。所以我现在的问题是:

另一种选择是将所有内容都放在一个 WebService 中。但我不喜欢这种方法,因为 EJB 中的事务和池优势以及受限的可扩展性。所以,如果你能给我你的意见,你将如何实施这个项目,我将不胜感激。

这是我的建议,但我也是 JavaEE 的初学者,所以可能还有其他方法。

您需要先建立

Parent POM 通过在 Parent POM 项目中使用 Maven,放入所有依赖项,然后创建一个模块,如

parent-project[pom]:
     project-name-data.jar
     project-name-services.jar
     project-name-webservice.war
     project-name-ui.war

通过这种方式,您可以在您的应用程序上使用所有共享库。

How should i implement the components with all the database stuff? (I would use EJB, because of the Pooling and the transaction stuff)

将在project-name-data.jar中完成并在project-name-services.jar[=36=中实施]

How should i implement the component(s), which are using the native library through JNI, but also have to interact with the database? (Jax-WS WebService, EJB declared as JAX-WS service?

将在project-name-webservice.war中实现,添加JAX-WS服务,project-name-services.jar 依赖。

在你的 project-name-ui.war 添加 project-name-webservice.war 的依赖到 运行 你的申请没问题。

如果你不清楚这一点,那么click here。这是我使用 EJB、Jax-RS 和其他库的个人尝试。希望对你有帮助。