Excellent Advice-

and use ConfigurationContext as your Context parameter for init() and destroy() methods
Take a look at this excellent tutorial-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.
 

 
----- Original Message -----
From: Tony Dean
Sent: Saturday, July 22, 2006 5:25 PM
Subject: RE: [Axis2] How to perform startup initialization?

You can code your service to implement service lifecycle semantics:
init(ServiceContext sc)
destroy(ServiceContext sc)
 
If your service is configured with scope="application" (service.xml), then your init() will be called once when your service is loaded and once when your application is destroyed.  You can then perform your DB connections and any other one time initialization more conveniently.


From: Dave Cowing [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 22, 2006 3:04 PM
To: [email protected]
Subject: [Axis2] How to perform startup initialization?

I'm getting started with Axis 2 and am looking to perform some initialization when axis2 starts up.  Specifically, I'm looking to configure a database pool and a couple of other resource pools that will be shared by web services.
 
In a servlet, I do this by creating a servlet listener, configuring the pool objects and dropping them into the servlet context.
 
I assume that I should be looking at the Service Group or Configuration Context to store the pools.  I also tried creating an AxisObserver, but I don't seem to be able to access the contexts.
 
How can I create a method that's called when axis2 starts up and has access to these contexts?
 
Thanks,
Dave

Reply via email to