A “standardized” approach to the Java EE application lifecycle
When developing Java EE applications, I often encounter "problems" to stop when the application starts, and so on Now for Weblogic, there is a mechanism (application lifecycle listener) But if you want to keep your app free of APP stuff Server specific, you must find a different solution Some suggest using servlets loaded at startup and "abusing" init() / destroy()
Others say using servletcontextlistener To me, the last one sounds the best (according to Java doc for servletcontextlistener. Unfortunately, I tried JBoss 7 today. It seems that Jax WS WebServices are initialized before any other servlet, so before servletcontextlistener gets the notification
Novel - I just face some specific problems of application server here - or is there any "more appropriate" standard Java EE registration method to initialize before any WebService or servlet?
Solution
If your web service notes so
@javax.jws.WebService(...) public interface YourServiceEndpoint
They are not real servlets, but JBoss (Jax WS) will turn them into a startup
I'm using jboss-4.2 3. I also received these messages before my servletcontextlistner was called
[org.jboss.wsf.framework.management.DefaultEndpointRegistry] register: jboss.ws:context=crm,endpoint=YourService
But I want to know if this web service is available before the full application starts, because I receive the following message almost at the end of deployment
[org.jboss.wsf.stack.jbws.WSDLFilePublisher] WSDL published to: ... YourServlet(..).wsdl
So I guess this is a JBoss related problem Maybe we should test another application server to prove it