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 Rolando Cuevas <rc...@gmail.com> on 2007/11/22 14:08:12 UTC

axis2 with spring and application scope

I'm using axis2 1.3 with spring 2.0.4. Maybe I'm doing something
wrong, I have a <servicegroup> and the services inside the group have
scope="application". The services are spring beans, and they
themselves use other springbeans. I tested that the scope is working.
However, the services are not injected with  the beans they need. (the
beans that the services use are null)

If you modify the sample service pojoguidespring (from axis
distribution) to use application scope, it does not work.
(from services.xml
  <service name="SpringInit" class="sample.spring.service.SpringInit"
scope="application">
  <service name="WeatherSpringService" scope="application">
)
However when not setting scope (which defaults to request) sample
service pojoguidespring  works.

Is there a way to use Spring with a servicegroup and services with
application scope?

Thanks in advance.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: axis2 with spring and application scope

Posted by Rolando Cuevas <rc...@gmail.com>.
On Nov 22, 2007 9:39 AM, robert lazarski <ro...@gmail.com> wrote:
> Does your class have "implements ServiceLifeCycle" ?  Basically,
> ServiceLifeCycle is a axis2 supplied way to do init somewhat like what
> HttpServlet and load-on-startup does - mostly for  any type of inside
> the aar init IIRC. So ServiceLifeCycle is just one option.

Yes The class I use to init Spring implements ServiceLifeCycle.
There are no exceptions in the log. I see the startup method is
called. Also the log shows the spring beans are created.
However when the service is called, the needed beans are not there.
When the service has application scope, it seems as if the classes for
the services are obtained by Axis itself (without using spring)
I also tested the exploded version of my service. It shows the same
behavior, the needed bean s are null.

The easiest way to reproduce the situation is to modify the sample
service pojoguidespring (from axis distribution). When services.xml is
modified to use application scope, the service does not work. (the
sample pojoguidespring works when using scope request).

Thanks.

> Perhaps Deepal can comment on application scope with ServiceLifeCycle
> as I've never tried that. Are you seeing any exceptions in the logs?
>
> I know its possible to run spring outside the aar, using the servlet
> container to init spring via putting all the spring jars in
> WEB-INF/lib .
>
> HTH,
> Robert
>
>
> On Nov 22, 2007 8:08 AM, Rolando Cuevas <rc...@gmail.com> wrote:
> > I'm using axis2 1.3 with spring 2.0.4. Maybe I'm doing something
> > wrong, I have a <servicegroup> and the services inside the group have
> > scope="application". The services are spring beans, and they
> > themselves use other springbeans. I tested that the scope is working.
> > However, the services are not injected with  the beans they need. (the
> > beans that the services use are null)
> >
> > If you modify the sample service pojoguidespring (from axis
> > distribution) to use application scope, it does not work.
> > (from services.xml
> >   <service name="SpringInit" class="sample.spring.service.SpringInit"
> > scope="application">
> >   <service name="WeatherSpringService" scope="application">
> > )
> > However when not setting scope (which defaults to request) sample
> > service pojoguidespring  works.
> >
> > Is there a way to use Spring with a servicegroup and services with
> > application scope?
> >
> > Thanks in advance.
> >
> > ---------------------------------------------------------------------
> > 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: axis2 with spring and application scope

Posted by robert lazarski <ro...@gmail.com>.
Does your class have "implements ServiceLifeCycle" ?  Basically,
ServiceLifeCycle is a axis2 supplied way to do init somewhat like what
HttpServlet and load-on-startup does - mostly for  any type of inside
the aar init IIRC. So ServiceLifeCycle is just one option.

Perhaps Deepal can comment on application scope with ServiceLifeCycle
as I've never tried that. Are you seeing any exceptions in the logs?

I know its possible to run spring outside the aar, using the servlet
container to init spring via putting all the spring jars in
WEB-INF/lib .

HTH,
Robert

On Nov 22, 2007 8:08 AM, Rolando Cuevas <rc...@gmail.com> wrote:
> I'm using axis2 1.3 with spring 2.0.4. Maybe I'm doing something
> wrong, I have a <servicegroup> and the services inside the group have
> scope="application". The services are spring beans, and they
> themselves use other springbeans. I tested that the scope is working.
> However, the services are not injected with  the beans they need. (the
> beans that the services use are null)
>
> If you modify the sample service pojoguidespring (from axis
> distribution) to use application scope, it does not work.
> (from services.xml
>   <service name="SpringInit" class="sample.spring.service.SpringInit"
> scope="application">
>   <service name="WeatherSpringService" scope="application">
> )
> However when not setting scope (which defaults to request) sample
> service pojoguidespring  works.
>
> Is there a way to use Spring with a servicegroup and services with
> application scope?
>
> Thanks in advance.
>
> ---------------------------------------------------------------------
> 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