You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ru...@enabler.com on 2007/06/12 18:26:08 UTC
RE: How to get information at startup of tomcat
Hi Michele,
I am using now the axis2, and I did what you said. I put the method init
and destroy into my service class.
All works fine, but now I modified the scope from "application" to
"request", to force the creation of a new instance of the service class
per request. I did this modification because I want to process various
requests in simultaneous.
With this modification, each time a request is done the init method is
invoked, and I want that it will be only invoked one time.
I did some researches on this and discovered that axis2 has a
ConfigurationContext. Can I use ConfigurationContext to put some data at
startup of tomcat or axis? If yes, How I can do that?
Do you know another solution to solve this problem? For me is very
import to keep the request scope.
Regards,
Rui Torres
-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
Sent: Thursday, May 17, 2007 5:26 PM
To: axis-user@ws.apache.org
Subject: RE: How to get information at startup of tomcat
Rui,
you said you're using axis 1.4. Those methods are available only with
*axis2*.
Michele
On Thu, 2007-05-17 at 17:17 +0100, rui.torres@enabler.com wrote:
> Michele,
>
> I put the method init and destroy in my Java class, but they are never
> invoked.
> What is wrong?
>
> Regards,
>
> Rui Torres
>
>
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: Thursday, May 17, 2007 2:52 PM
> To: axis-user@ws.apache.org
> Subject: RE: How to get information at startup of tomcat
>
> What I said applies to Axis2.
>
>
> Michele
>
> On Thu, 2007-05-17 at 14:37 +0100, rui.torres@enabler.com wrote:
> > Sorry Michele,
> >
> > I am using axis 1.4, and the binary distribution doesn't have
> > axis2-kernel-1.2.jar
> >
> > Regards,
> >
> > Rui Torres
> >
> > -----Original Message-----
> > From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> > Sent: Thursday, May 17, 2007 11:50 AM
> > To: axis-user@ws.apache.org
> > Subject: RE: How to get information at startup of tomcat
> >
> > http://ws.apache.org/axis2/1_2/api/org/apache/axis2/context/ServiceC
> > on
> > te
> > xt.html
> >
> > It's where I told you, in axis2-kernel.jar. Donwload the binary
> > distribution go to the lib folder and type jar tf
> > axis2-kernel-1.2.jar
>
> > | grep ServiceContext
> >
> > Michele
> >
> > On Thu, 2007-05-17 at 11:08 +0100, rui.torres@enabler.com wrote:
> > > Sorry,
> > >
> > > But where I can find it? I did some searches, but I didn't find
it.
> > >
> > > Rui Torres
> > >
> > > -----Original Message-----
> > > From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> > > Sent: Thursday, May 17, 2007 10:54 AM
> > > To: axis-user@ws.apache.org
> > > Subject: RE: How to get information at startup of tomcat
> > >
> > > org.apache.axis2.context.ServiceContext. It should be in
> > > axis2-kernel.jar.
> > >
> > > Michele
> > >
> > > On Thu, 2007-05-17 at 10:50 +0100, rui.torres@enabler.com wrote:
> > > > Hi Michele,
> > > >
> > > > I put the method init in my class, but when I compile my class,
> > > > the compiler doesn't find the definition of ServiceContext
class.
> > > >
> > > > Can you say me which jar I must include.
> > > >
> > > > Regards
> > > >
> > > > Rui Torres
> > > >
> > > > -----Original Message-----
> > > > From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> > > > Sent: Thursday, May 17, 2007 10:28 AM
> > > > To: axis-user@ws.apache.org
> > > > Subject: RE: How to get information at startup of tomcat
> > > >
> > > > Hi Tui,
> > > >
> > > >
> > > >
> > > > On Thu, 2007-05-17 at 10:23 +0100, rui.torres@enabler.com wrote:
> > > > > Hi Michele,
> > > > >
> > > > > Thank you for your help.
> > > > >
> > > > > I want to know where I put the init and destroy methods.
> > > > >
> > > > You should put those methods into your service class.
> > > >
> > > > > Are these methods only invoked when a startup and a shutdown
> > > > > is done
> > >
> > > > > in tomcat? Or they are invoked every time my webservice is
> > invoked?
> > > >
> > > > No, only when the service is loaded and unloaded (which can
> > > > differ
>
> > > > from startup/shutdown).
> > > > >
> > > > > Regards,
> > > > >
> > > > > Rui Torres
> > > >
> > > >
> > > > Michele
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> > > > > Sent: Wednesday, May 16, 2007 7:38 PM
> > > > > To: axis-user@ws.apache.org
> > > > > Subject: Re: How to get information at startup of tomcat
> > > > >
> > > > > Rui,
> > > > >
> > > > > what about the ServiceContext?
> > > > > In your service add these two methods (they will be invoked
> > > > > via
> > > > > reflection)
> > > > >
> > > > > public void init(ServiceContext serviceContext) {
> > > > > // put your initialization code here }
> > > > >
> > > > > public void destroy(ServiceContext serviceContext) {
> > > > > // this code will be executed when the service is
> unloaded }
> > > > >
> > > > > The ServiceContext has a Map where you can store your stuff
> > > > > (getProperties(), getProperty(), setProperty()) If you want to
> > > > > access your data when you process client requests:
> > > > >
> > > > > public OMElement foo(OMElement el) {
> > > > > ServiceContext sCtx =
> MessageContext.getCurrentMessageContext
> > > > > ().getServiceContext();
> > > > > // read/write/update your stuff
> > > > >
> > > > > //process the request
> > > > > }
> > > > >
> > > > >
> > > > > Michele
> > > > >
> > > > >
> > > > >
> > > > > On 16 May 2007, at 19:15, <ru...@enabler.com>
> > > > > <ru...@enabler.com> wrote:
> > > > >
> > > > > > Hi all,
> > > > > >
> > > > > >
> > > > > > I am developing a webservice with axis/tomcat, which gets
> > > > > > some
>
> > > > > > information from a database. The problem is that the
> > > > > > information
> >
> > > > > > is not modified frequently, and is obtained each time that
> > > > > > my webservice is invoked.
> > > > > >
> > > > > > I want to know if it is possible to get this information
> > > > > > after
>
> > > > > > the
> > >
> > > > > > startup of the tomcat, put it somewhere in a structure (it
> > > > > > can
>
> > > > > > be in
> > > >
> > > > > > an object), and then access it inside my classes.
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > Rui Torres
> > > > >
> > > > >
> > > > > --------------------------------------------------------------
> > > > > --
> > > > > --
> > > > > --
> > > > > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > > > >
> > > > > --------------------------------------------------------------
> > > > > --
> > > > > --
> > > > > --
> > > > > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > > >
> > > >
> > > > ----------------------------------------------------------------
> > > > --
> > > > --
> > > > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > > > ----------------------------------------------------------------
> > > > --
> > > > --
> > > > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: How to get information at startup of tomcat
Posted by ru...@enabler.com.
Hi Michele,
I tried ServiceLifeCycle interface, and it works fine.
Thanks for your help.
Regards,
Rui Torres
-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
Sent: Wednesday, June 13, 2007 9:24 AM
To: axis-user@ws.apache.org
Subject: RE: How to get information at startup of tomcat
You can use the ServiceLifeCycle interface.
Michele
On Wed, 2007-06-13 at 09:08 +0100, Michele Mazzucco wrote:
> Rui,
>
> according to this [1] you're right. I'd suggest you to search through
> the old posts. I remember some discussions about this issues.
>
>
> Michele
>
> [1] http://wso2.org/library/163
>
> On Tue, 2007-06-12 at 18:07 +0100, rui.torres@enabler.com wrote:
> > Yes, I am sure.
> >
> > If you modify the scope to "request", the method init will be
> > executed each time that the webservice is invoked.
> >
> > Is it normal this behaviour?
> >
> > Rui Torres
> >
> >
> > -----Original Message-----
> > From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> > Sent: Tuesday, June 12, 2007 5:54 PM
> > To: axis-user@ws.apache.org
> > Subject: RE: How to get information at startup of tomcat
> >
> > On Tue, 2007-06-12 at 17:26 +0100, rui.torres@enabler.com wrote:
> > > With this modification, each time a request is done the init
> > > method is
> >
> > > invoked, and I want that it will be only invoked one time.
> >
> > Are you sure?, those methods should be called only once.
> >
> > Michele
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: How to get information at startup of tomcat
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
You can use the ServiceLifeCycle interface.
Michele
On Wed, 2007-06-13 at 09:08 +0100, Michele Mazzucco wrote:
> Rui,
>
> according to this [1] you're right. I'd suggest you to search through
> the old posts. I remember some discussions about this issues.
>
>
> Michele
>
> [1] http://wso2.org/library/163
>
> On Tue, 2007-06-12 at 18:07 +0100, rui.torres@enabler.com wrote:
> > Yes, I am sure.
> >
> > If you modify the scope to "request", the method init will be executed
> > each time that the webservice is invoked.
> >
> > Is it normal this behaviour?
> >
> > Rui Torres
> >
> >
> > -----Original Message-----
> > From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> > Sent: Tuesday, June 12, 2007 5:54 PM
> > To: axis-user@ws.apache.org
> > Subject: RE: How to get information at startup of tomcat
> >
> > On Tue, 2007-06-12 at 17:26 +0100, rui.torres@enabler.com wrote:
> > > With this modification, each time a request is done the init method is
> >
> > > invoked, and I want that it will be only invoked one time.
> >
> > Are you sure?, those methods should be called only once.
> >
> > Michele
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: How to get information at startup of tomcat
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Rui,
according to this [1] you're right. I'd suggest you to search through
the old posts. I remember some discussions about this issues.
Michele
[1] http://wso2.org/library/163
On Tue, 2007-06-12 at 18:07 +0100, rui.torres@enabler.com wrote:
> Yes, I am sure.
>
> If you modify the scope to "request", the method init will be executed
> each time that the webservice is invoked.
>
> Is it normal this behaviour?
>
> Rui Torres
>
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: Tuesday, June 12, 2007 5:54 PM
> To: axis-user@ws.apache.org
> Subject: RE: How to get information at startup of tomcat
>
> On Tue, 2007-06-12 at 17:26 +0100, rui.torres@enabler.com wrote:
> > With this modification, each time a request is done the init method is
>
> > invoked, and I want that it will be only invoked one time.
>
> Are you sure?, those methods should be called only once.
>
> Michele
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: How to get information at startup of tomcat
Posted by ru...@enabler.com.
Yes, I am sure.
If you modify the scope to "request", the method init will be executed
each time that the webservice is invoked.
Is it normal this behaviour?
Rui Torres
-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
Sent: Tuesday, June 12, 2007 5:54 PM
To: axis-user@ws.apache.org
Subject: RE: How to get information at startup of tomcat
On Tue, 2007-06-12 at 17:26 +0100, rui.torres@enabler.com wrote:
> With this modification, each time a request is done the init method is
> invoked, and I want that it will be only invoked one time.
Are you sure?, those methods should be called only once.
Michele
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: How to get information at startup of tomcat
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
On Tue, 2007-06-12 at 17:26 +0100, rui.torres@enabler.com wrote:
> With this modification, each time a request is done the init method is
> invoked, and I want that it will be only invoked one time.
Are you sure?, those methods should be called only once.
Michele
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org