I'm not sure I ever fully understood this, even after reading the docs on the 
service lifecycle a few times. What I found was that the methods did not fire 
the same way during hot deployment as they do on startup so don't get fooled by 
that. The best I came up with was use application scope, restart tomcat 
whenever I needed to apply a change, and the init method was the best place to 
put any one time setup code.

hth
charles

On Feb 10, 2010, at 5:23 AM, Doughty, Michael wrote:

> In your services.xml file, add 'scope=" application"' to the "service" 
> element, as follows:
> 
> <service name="***your service name***" scope=" application">
> 
> The service will then be deployable in application mode.
> 
> Now a question to Deepal... will this actually load the implementation class 
> immediately on deployment and thus cause all static initialization in the 
> class to take place?
> 
> I know that application mode will cause Axis2 to treat the implementation 
> class as a singleton and reuse the same instance for each service call, but I 
> was still under the impression that it would require that first service call 
> to be made still.  If the class is loaded on deployment or the singleton is 
> constructed prior to the first service call, then that is definitely good 
> news.
> 
> -----Original Message-----
> From: Oded Onn [mailto:oded....@mobixell.com] 
> Sent: Wednesday, February 10, 2010 3:21 AM
> To: axis-user@ws.apache.org
> Subject: RE: Initializing Web Service (Server) before first request received
> 
> 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