Hi,
I want an EJB call a Servlet *on the same server* on server startup.
This looks very easy, but is very hard.
@Startup / @Singleton / @PostConstruct is triggered before the http port is up and open, so @PostConstruct hangs forever. Indeed as @PostConstruct never comes back, the server never opens the listen port.
Tried to trigger the EJB from an @WebListener. Same behaviour.
Is there a better way than to trigger in @PostConstruct an EJB Timer that waits a minute or so and then calls the servlet?
Is there a Server-is-up-and-running-Callback?
For Tomcat this would be Lifecycle.AFTER_START_EVENT
https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/Lifecycle.html#AFTER_START_EVENT