JBoss Community

Re: Load on startup is ignored - JaxWS webservice is always initialized first

created by rushead in JBoss AS7 Development - View the full discussion

Thank you for your response.

 

But I have some more questions:

Jim Ma schrieb:

  • Why is "<load-on-startup>" ignored when the implementation differ only in the WS implementation?

It is not ignored. The <load-on-startup> configured to HelloServlet is passed to org.jboss.wsf.stack.cxf.CXFServletExt.  I tried with your example it works properly.

I think I misunderstood the difference between the "real" servlets and the "fake" servlets.

Both mechanisms (<load-on-startup> and ServletContextListener#contextInitialized) worked for me with JBoss AS 5.1 so that the HelloServlet (JaxWS implementation) was instantiated after the ServletContextListner was called / after the StartupServlet was initialized.

In my opinion it should not make a difference if I implement a "real" servlet (using "implements Servlet") or using JaxWS to build a Webservice.

 

Jim Ma schrieb:

rushead wrote:

  • Last but not least: What is the best and usual way to initialize a custom environment for several servlets in a war file?

I did not get what you want to initialize from the source code(maybe I missed something), so I am not sure if do the initialize work in a real servlet and inject something with WebServiceContext can help. Here is some documentation about how to access MessageContext and/or Http request and response:http://cxf.apache.org/docs/servlet-transport.html

I am trying to initialize a custom application context and resource management which is used in all my servlets and webservices (sometimes even in the constructor to load the configuration).

The problem is, that i have to initialize the context/resource management before the servlets and webservices are instantiated (of course).

What is the common way to solve this problem?

And why did it work in JBoss AS 5.1 and does not work anymore in the current AS 7?

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community