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
