Return-Path: Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 83289 invoked by uid 500); 1 Jul 2003 05:16:59 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 83278 invoked from network); 1 Jul 2003 05:16:58 -0000 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: RE: Service Class as Singleton Class Date: Mon, 30 Jun 2003 22:17:08 -0700 Message-ID: <07EC20A3290A504EA73D914B4C08A48602720C69@usmail14.informatica.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Service Class as Singleton Class Thread-Index: AcMkCXoykWbbCZL4TtmFLJp1kl6EkwbhtVUQ From: "Agarwal, Naresh" To: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Aaron/Niket, I believe you can tackle this problem by having your service class = deployed in "application" scope in AXIS.=20 Internally AXIS will make sure that only once instance of this service = class would serve all the request during the life time of Tomcat (or the servlet = container used). regards, Naresh Agarwal -----Original Message----- From: Aaron Knauf [mailto:aknauf@xtra.co.nz] Sent: Tuesday, May 27, 2003 10:06 AM To: axis-dev@ws.apache.org Subject: Re: Service Class as Singleton Class The problem is that Axis instantiates and new service class instance=20 each time the service is invoked, using reflection to find the public=20 constructor. It would be difficult to get Axis to cater for singletons, = as the getInstance method could be called anything. I found the instantiation of a new service class for each invocation to=20 be a problem, so I worked around it by implementing my service class as=20 a proxy to a singleton implementation class. The wrapper gets=20 instantiated every time, but the class that implements all the logic is=20 only instantiated once. This was to avoid expensive initialization code = (such as starting up a pool of connections to a CORBA server) from being = executed repeatedly, but it had the handy side effect of allowing me to=20 read in my config from the WSDD file in this wrapper, too, therby hiding = the fact that the thing was running as a web service from the impl = class. Hope this helps. Cheers ADK Niket Anand wrote: > =20 > > > Hello All, > I am newbie to Axis. I am facing problem as > java.lang.InstantiationException > = > exception when my service class is Singleton class and having > private constructor and getInstance() to get instance of this > class. When axis client ask for a method from the service class > then it throw this exception. If I remove the Singleton ability > and provide public constructor then it works fine. But I want it > to be remain Singleton . Please help me How to work with Service > class as Singleton and what modification needs to be done in wsdd. > =20 > waiting for reply... > thanks, > Niket >