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.
It is possible to configure it via
Starting weight
in the module configuration (Enterprise Applications > YourApplication > Manage Modules > ejbmoduleb.jar
)If you need order dependency among whole applications, you set
Startup order
in theStartup behavior
application configuration (Enterprise Applications > YourApplication > Startup behavior
)If you plan to have
application.xml
deployment descriptor add the following entry to the descriptor and provide modules in the correct order.See also: