How WebSphere manages startup order of EJB jars?

走远了吗. 提交于 2020-01-04 16:56:11

问题


When an ear would contain two ejb modules modulea.jar and moduleb.jar. And modulea.jar contains an @Startup ejbX, that calls another ejbY, which is not an @Startup ejb, from moduleb.jar during the startup of the bean X it is required that moduleb.jar is started first as otherwise the app server is not able to inject X into Y. But how to ensure that moduleb.jar is started first?

Currently I have this problem in WebSphere, but I can't seem to find a way to enforce an order. Is there something in the spec to manage order?

Or maybe WebSphere specific (rather not have vendor lock in though). Maybe it is a poor design to have a startup ejb and an ejb that is used by it in different modules, some insight about that is also welcome.


回答1:


It is possible to configure it via Starting weight in the module configuration (Enterprise Applications > YourApplication > Manage Modules > ejbmoduleb.jar)

Starting weight

Specifies the order in which modules are started when the server starts. The module with the lowest starting weight is started first.

If you need order dependency among whole applications, you set Startup order in the Startup behavior application configuration (Enterprise Applications > YourApplication > Startup behavior)

Startup order

Specifies the order in which applications are started when the server starts. The startup order is like a starting weight. The application with the lowest starting weight is started first.

If you plan to have application.xml deployment descriptor add the following entry to the descriptor and provide modules in the correct order.

<initialize-in-order>true</initialize-in-order>

See also:

  • EJB module settings
  • Application startup behavior


来源:https://stackoverflow.com/questions/30068311/how-websphere-manages-startup-order-of-ejb-jars

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!