0 Replies Latest reply on Dec 10, 2010 11:35 AM by George F. Santamarina

    Is there a better way to initialize a JAX-WS web service?

    George F. Santamarina Newbie
      I've created a web service that uses a set of MBeans to hold configuration information for the web service.  I'd like to have the ability to configure the MBeans via the JMX console prior to the first web service call.
      After looking at various posts (Initializing an Application on Deployment using JMX - http://community.jboss.org/message/167063#167063 and ServiceLifecycle in JossWS 2.0.1 - http://community.jboss.org/message/337582#337582), I've come to the conclusion that there is no real good way of initializing a web service.
      The solution we're using right now is to create an initialization servlet with the <load-on-startup> node so that it loads on startup.  The only thing that the servlet does is have an init() method where we then put the MBeans initialization.  It seems to work.
      Is there any better way of doing this just using the web services framework without having to depend on servlets?
      We are using JBoss [Trinity] 4.2.3.GA that comes with jbossws-3.0.1-native-2.0.4.GA so we cannot take advantage of the org.jboss.ws.eagerInitializeJAXBContextCache flag in jbossws 3.0.3 (http://community.jboss.org/wiki/JBossWS-Tuning#Eager_initialization) though I'm not sure it would help us any since this is not a JAXB issue.

      I am using JBoss [Trinity] 4.2.3.GA.

       

      I've created a web service that uses a set of MBeans to hold configuration information for a JAX-WS web service.  I'd like to have the ability to configure the MBeans via the JMX console prior to the first incoming web service call.

       

      After looking at various posts (Initializing an Application on Deployment using JMX and ServiceLifecycle in JossWS 2.0.1), I've come to the conclusion that there is likely no good way of doing initialization at container start-up time within a JAX-WS web service.

       

      Right now, the solution I've settled on is to have a very simple initialization servlet that is loaded at startup time using the <load-on-startup> node in the web.xml.  The only thing that the servlet does is have an init() method where the MBeans for the web service are initialized.  It seems to work.

       

      Question: Is there any better way of doing this just using the web services framework without having to depend on servlets?

       

      JBoss 4.2.3 comes with jbossws-3.0.1-native-2.0.4.GA so I cannot take advantage of the org.jboss.ws.eagerInitializeJAXBContextCache flag in jbossws 3.0.3 though I'm not sure it would help any since this is not a JAXB issue.

       

       

      Thanks.