Hello,

If you are using Tomcat , you can create an InitializerServlet Class that
extend HttpServlet , you override the init() method and put into a call to
your business logic.

On the web.xml :

<servlet>
    <servlet-name>TheInitializerServlet</servlet-name>
    <servlet-class>package.InitializerServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
</servlet>

So the servlet will be loaded at start up and , you business logic will be
executed for the first time (so all classes needed will be loaded) ,
After, when you make the first request to your service it will not take the
time of loading classes.

Ragards,



On 2/10/10, Oded Onn <oded....@mobixell.com> wrote:
>
> Deepal,
> Can you please elaborate a bit more. I am not sure I quite understand
> what you mean.
> Thanks,
> Oded
>
> -----Original Message-----
> From: Deepal Jayasinghe [mailto:dee...@opensource.lk]
> Sent: Wednesday, February 10, 2010 00:58
> To: axis-user@ws.apache.org
> Subject: Re: Initializing Web Service (Server) before first request
> received
>
> Deploy there service in Application scope.
>
> Thanks,
> Deepal
> >
> > Hi all,
> >
> >
> >
> > I am deploying an AXIS2 web service (server side).
> >
> >
> >
> > My problem: The skeleton class (the one that performs all the business
> > logic) is read for the first time only when the first request is
> > received by the server. It means that the first response takes a
> > really long time (up to 20 seconds on a weak machine) since there are
> > a lot of initialization I have to perform (static init).
> >
> >
> >
> > Solution: I am assuming I can write some sort of a main class that
> > will try to call the skeleton class. This is not only ugly but also
> > prone to all sorts of errors. Is there a proper way to init my service
> > class? I would expect some mechanism to be used, such as utilizing the
> > servlet init of the axis servlet.
> >
> >
> >
> > Anyone? Thanks!
> >
> > Oded
> >
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>

Reply via email to