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 Inigo Surguy <in...@hotmail.com> on 2006/01/18 15:55:01 UTC

[Axis2-0.94] Classpath for Axis code running inside an .aar?

Hi,

I've deployed a .aar to Axis 2, and I'm trying to use Spring within it. 
However, when Spring tries to access it's applicationContext.xml file from 
the classpath, it doesn't work. When I try to access the classpath in my own 
code, using MyObject.class.getResource() or 
Thread.currentThread().getContextClassLoader().getResource(), I can't find 
the file either; and when I check the classloader roots of the current 
context classloader, it only shows Tomcat 
5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

When I move my applicationContext.xml to the Axis WEB-INF/classes directory, 
then Spring can find it, which is consistent with the behaviour above. 
However, it then can't load any of my application classes - presumably 
because they're not on the classpath available to my application.

I can presumably solve this by moving all of my code into the Axis 
WEB-INF/lib directory - but this defeats the point of having an .aar!

What am I doing wrong, please? How can I get the contents of the .aar onto 
the classpath of classes within that .aar?

(I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

Cheers

Inigo



Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Nathaniel Auvil <na...@gmail.com>.
I don't mean to sound negative, but what is the purpose of the aar archive
format?  Why not just use the simple deployment model like axis 1.x?



On 1/18/06, iksrazal <ik...@gmail.com> wrote:
>
> Hi Inigo,
>
> I also use Spring with Axis2, but in general I haven't trusted the aar
> classloader due to some early problems around the .92 frame.
>
> So I use a bare bones aar structure:
>
> ./META-INF
> ./META-INF/MANIFEST.MF
> ./META-INF/SWAWiseEndpoint.wsdl
> ./META-INF/services.xml
> ./com
> ./com/siemens
> ./com/siemens/swa
> ./com/siemens/swa/webservices
> ./com/siemens/swa/webservices/wisemobil
> ./com/siemens/swa/webservices/wisemobil/SWAWiseEndpointSkeleton.class
>
> And put the rest of the classes - several hundred or so as its a big web
> app
> and web services are only one part - into WEB-INF/classes .  All the
> spring
> etc jars go into WEB-INF/lib .
>
> As far as spring goes, any bean dependencies in the skeleton are resolved
> with
> an object factory. The rest of the beans, transactions for hibernate etc,
> get
> loaded via web.xml, applicationContext.xml, serviceContext.xml etc as one
> normally would do with Spring.
>
> HTH,
> iksrazal
> http://www.braziloutsource.com/
>
> Em Quarta 18 Janeiro 2006 12:55, o Inigo Surguy escreveu:
> > Hi,
> >
> > I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> > However, when Spring tries to access it's applicationContext.xml file
> from
> > the classpath, it doesn't work. When I try to access the classpath in my
> > own code, using MyObject.class.getResource() or
> > Thread.currentThread().getContextClassLoader().getResource(), I can't
> find
> > the file either; and when I check the classloader roots of the current
> > context classloader, it only shows Tomcat
> > 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
> >
> > When I move my applicationContext.xml to the Axis WEB-INF/classes
> > directory, then Spring can find it, which is consistent with the
> behaviour
> > above. However, it then can't load any of my application classes -
> > presumably because they're not on the classpath available to my
> > application.
> >
> > I can presumably solve this by moving all of my code into the Axis
> > WEB-INF/lib directory - but this defeats the point of having an .aar!
> >
> > What am I doing wrong, please? How can I get the contents of the .aar
> onto
> > the classpath of classes within that .aar?
> >
> > (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
> >
> > Cheers
> >
> > Inigo
>
> --
>

Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by iksrazal <ik...@gmail.com>.
Hi Inigo, 

I also use Spring with Axis2, but in general I haven't trusted the aar 
classloader due to some early problems around the .92 frame. 

So I use a bare bones aar structure: 

./META-INF
./META-INF/MANIFEST.MF
./META-INF/SWAWiseEndpoint.wsdl
./META-INF/services.xml
./com
./com/siemens
./com/siemens/swa
./com/siemens/swa/webservices
./com/siemens/swa/webservices/wisemobil
./com/siemens/swa/webservices/wisemobil/SWAWiseEndpointSkeleton.class

And put the rest of the classes - several hundred or so as its a big web app 
and web services are only one part - into WEB-INF/classes .  All the spring 
etc jars go into WEB-INF/lib . 

As far as spring goes, any bean dependencies in the skeleton are resolved with 
an object factory. The rest of the beans, transactions for hibernate etc, get 
loaded via web.xml, applicationContext.xml, serviceContext.xml etc as one 
normally would do with Spring. 

HTH,
iksrazal
http://www.braziloutsource.com/

Em Quarta 18 Janeiro 2006 12:55, o Inigo Surguy escreveu:
> Hi,
>
> I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> However, when Spring tries to access it's applicationContext.xml file from
> the classpath, it doesn't work. When I try to access the classpath in my
> own code, using MyObject.class.getResource() or
> Thread.currentThread().getContextClassLoader().getResource(), I can't find
> the file either; and when I check the classloader roots of the current
> context classloader, it only shows Tomcat
> 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
>
> When I move my applicationContext.xml to the Axis WEB-INF/classes
> directory, then Spring can find it, which is consistent with the behaviour
> above. However, it then can't load any of my application classes -
> presumably because they're not on the classpath available to my
> application.
>
> I can presumably solve this by moving all of my code into the Axis
> WEB-INF/lib directory - but this defeats the point of having an .aar!
>
> What am I doing wrong, please? How can I get the contents of the .aar onto
> the classpath of classes within that .aar?
>
> (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
>
> Cheers
>
> Inigo

-- 

Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Davanum Srinivas <da...@gmail.com>.
We had the exact same problem in Geronimo when GBeans are loaded:
http://www.nabble.com/TCCL-in-doStart-t465585.html

At least in Geronimo's case everyone agreed that the correct behavior
was to set TCCL to the correct class loader around lifecycle methods.

thanks,
dims

On 1/19/06, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Hi dims;
>
> I did not mean that , all the resources in the aar file available to Service
> (that is how I create service at deployment time) , the problem here is not
> that (if I understand correct). Spring trying to load some resources
> (configuration file) and which does not have any idea about service class
> loader eventhough resources are in that class loader.
>
> I can not find a way to fix this without giving Spring the service class
> loader , but that we can not do that since that does not take class loader
> and its internally used CCL. And that CCL is incapable of loading service
> resources.
>
> hmmmmmmmmm
>
> Thanks,
>  Deepal
> ................................................................
> ~Future is Open~
>
> ----- Original Message -----
> From: "Davanum Srinivas" <da...@gmail.com>
> To: <ax...@ws.apache.org>
> Sent: Thursday, January 19, 2006 6:58 PM
> Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?
>
>
> Deepal,
>
> Service isolation does not mean that resources present in aar should
> not be available to the services themselves. there is a hole, we need
> to figure out how to fix it.
>
> thanks,
> dims
>
> On 1/18/06, Deepal Jayasinghe <de...@opensource.lk> wrote:
> > hi dims;
> >
> > that s not a bug in Axis2 , to be fix , he is getting that error due to
> > service isolation that's an Axis2 feature.
> >
> > Thanks,
> >  Deepal
> > ................................................................
> > ~Future is Open~
> >
> > ----- Original Message -----
> > From: "Davanum Srinivas" <da...@gmail.com>
> > To: <ax...@ws.apache.org>
> > Sent: Wednesday, January 18, 2006 9:40 PM
> > Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?
> >
> >
> > Please log a JIRA bug. Looks serious.
> >
> > thanks,
> > dims
> >
> > On 1/18/06, Inigo Surguy <in...@hotmail.com> wrote:
> > > Hi,
> > >
> > > I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> > > However, when Spring tries to access it's applicationContext.xml file
> > > from
> > > the classpath, it doesn't work. When I try to access the classpath in my
> > > own
> > > code, using MyObject.class.getResource() or
> > > Thread.currentThread().getContextClassLoader().getResource(), I can't
> > > find
> > > the file either; and when I check the classloader roots of the current
> > > context classloader, it only shows Tomcat
> > > 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
> > >
> > > When I move my applicationContext.xml to the Axis WEB-INF/classes
> > > directory,
> > > then Spring can find it, which is consistent with the behaviour above.
> > > However, it then can't load any of my application classes - presumably
> > > because they're not on the classpath available to my application.
> > >
> > > I can presumably solve this by moving all of my code into the Axis
> > > WEB-INF/lib directory - but this defeats the point of having an .aar!
> > >
> > > What am I doing wrong, please? How can I get the contents of the .aar
> > > onto
> > > the classpath of classes within that .aar?
> > >
> > > (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
> > >
> > > Cheers
> > >
> > > Inigo
> > >
> > >
> > >
> >
> >
> > --
> > Davanum Srinivas : http://wso2.com/blogs/
> >
> >
> >
>
>
> --
> Davanum Srinivas : http://wso2.com/blogs/
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/

Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi dims;

I did not mean that , all the resources in the aar file available to Service 
(that is how I create service at deployment time) , the problem here is not 
that (if I understand correct). Spring trying to load some resources 
(configuration file) and which does not have any idea about service class 
loader eventhough resources are in that class loader.

I can not find a way to fix this without giving Spring the service class 
loader , but that we can not do that since that does not take class loader 
and its internally used CCL. And that CCL is incapable of loading service 
resources.

hmmmmmmmmm

Thanks,
 Deepal
................................................................
~Future is Open~

----- Original Message ----- 
From: "Davanum Srinivas" <da...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Thursday, January 19, 2006 6:58 PM
Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?


Deepal,

Service isolation does not mean that resources present in aar should
not be available to the services themselves. there is a hole, we need
to figure out how to fix it.

thanks,
dims

On 1/18/06, Deepal Jayasinghe <de...@opensource.lk> wrote:
> hi dims;
>
> that s not a bug in Axis2 , to be fix , he is getting that error due to
> service isolation that's an Axis2 feature.
>
> Thanks,
>  Deepal
> ................................................................
> ~Future is Open~
>
> ----- Original Message -----
> From: "Davanum Srinivas" <da...@gmail.com>
> To: <ax...@ws.apache.org>
> Sent: Wednesday, January 18, 2006 9:40 PM
> Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?
>
>
> Please log a JIRA bug. Looks serious.
>
> thanks,
> dims
>
> On 1/18/06, Inigo Surguy <in...@hotmail.com> wrote:
> > Hi,
> >
> > I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> > However, when Spring tries to access it's applicationContext.xml file 
> > from
> > the classpath, it doesn't work. When I try to access the classpath in my
> > own
> > code, using MyObject.class.getResource() or
> > Thread.currentThread().getContextClassLoader().getResource(), I can't 
> > find
> > the file either; and when I check the classloader roots of the current
> > context classloader, it only shows Tomcat
> > 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
> >
> > When I move my applicationContext.xml to the Axis WEB-INF/classes
> > directory,
> > then Spring can find it, which is consistent with the behaviour above.
> > However, it then can't load any of my application classes - presumably
> > because they're not on the classpath available to my application.
> >
> > I can presumably solve this by moving all of my code into the Axis
> > WEB-INF/lib directory - but this defeats the point of having an .aar!
> >
> > What am I doing wrong, please? How can I get the contents of the .aar 
> > onto
> > the classpath of classes within that .aar?
> >
> > (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
> >
> > Cheers
> >
> > Inigo
> >
> >
> >
>
>
> --
> Davanum Srinivas : http://wso2.com/blogs/
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/



Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Davanum Srinivas <da...@gmail.com>.
Deepal,

Service isolation does not mean that resources present in aar should
not be available to the services themselves. there is a hole, we need
to figure out how to fix it.

thanks,
dims

On 1/18/06, Deepal Jayasinghe <de...@opensource.lk> wrote:
> hi dims;
>
> that s not a bug in Axis2 , to be fix , he is getting that error due to
> service isolation that's an Axis2 feature.
>
> Thanks,
>  Deepal
> ................................................................
> ~Future is Open~
>
> ----- Original Message -----
> From: "Davanum Srinivas" <da...@gmail.com>
> To: <ax...@ws.apache.org>
> Sent: Wednesday, January 18, 2006 9:40 PM
> Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?
>
>
> Please log a JIRA bug. Looks serious.
>
> thanks,
> dims
>
> On 1/18/06, Inigo Surguy <in...@hotmail.com> wrote:
> > Hi,
> >
> > I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> > However, when Spring tries to access it's applicationContext.xml file from
> > the classpath, it doesn't work. When I try to access the classpath in my
> > own
> > code, using MyObject.class.getResource() or
> > Thread.currentThread().getContextClassLoader().getResource(), I can't find
> > the file either; and when I check the classloader roots of the current
> > context classloader, it only shows Tomcat
> > 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
> >
> > When I move my applicationContext.xml to the Axis WEB-INF/classes
> > directory,
> > then Spring can find it, which is consistent with the behaviour above.
> > However, it then can't load any of my application classes - presumably
> > because they're not on the classpath available to my application.
> >
> > I can presumably solve this by moving all of my code into the Axis
> > WEB-INF/lib directory - but this defeats the point of having an .aar!
> >
> > What am I doing wrong, please? How can I get the contents of the .aar onto
> > the classpath of classes within that .aar?
> >
> > (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
> >
> > Cheers
> >
> > Inigo
> >
> >
> >
>
>
> --
> Davanum Srinivas : http://wso2.com/blogs/
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/

Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Deepal Jayasinghe <de...@opensource.lk>.
hi dims;

that s not a bug in Axis2 , to be fix , he is getting that error due to 
service isolation that's an Axis2 feature.

Thanks,
 Deepal
................................................................
~Future is Open~

----- Original Message ----- 
From: "Davanum Srinivas" <da...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Wednesday, January 18, 2006 9:40 PM
Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?


Please log a JIRA bug. Looks serious.

thanks,
dims

On 1/18/06, Inigo Surguy <in...@hotmail.com> wrote:
> Hi,
>
> I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> However, when Spring tries to access it's applicationContext.xml file from
> the classpath, it doesn't work. When I try to access the classpath in my 
> own
> code, using MyObject.class.getResource() or
> Thread.currentThread().getContextClassLoader().getResource(), I can't find
> the file either; and when I check the classloader roots of the current
> context classloader, it only shows Tomcat
> 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
>
> When I move my applicationContext.xml to the Axis WEB-INF/classes 
> directory,
> then Spring can find it, which is consistent with the behaviour above.
> However, it then can't load any of my application classes - presumably
> because they're not on the classpath available to my application.
>
> I can presumably solve this by moving all of my code into the Axis
> WEB-INF/lib directory - but this defeats the point of having an .aar!
>
> What am I doing wrong, please? How can I get the contents of the .aar onto
> the classpath of classes within that .aar?
>
> (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
>
> Cheers
>
> Inigo
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/



Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Davanum Srinivas <da...@gmail.com>.
Please log a JIRA bug. Looks serious.

thanks,
dims

On 1/18/06, Inigo Surguy <in...@hotmail.com> wrote:
> Hi,
>
> I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> However, when Spring tries to access it's applicationContext.xml file from
> the classpath, it doesn't work. When I try to access the classpath in my own
> code, using MyObject.class.getResource() or
> Thread.currentThread().getContextClassLoader().getResource(), I can't find
> the file either; and when I check the classloader roots of the current
> context classloader, it only shows Tomcat
> 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
>
> When I move my applicationContext.xml to the Axis WEB-INF/classes directory,
> then Spring can find it, which is consistent with the behaviour above.
> However, it then can't load any of my application classes - presumably
> because they're not on the classpath available to my application.
>
> I can presumably solve this by moving all of my code into the Axis
> WEB-INF/lib directory - but this defeats the point of having an .aar!
>
> What am I doing wrong, please? How can I get the contents of the .aar onto
> the classpath of classes within that .aar?
>
> (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
>
> Cheers
>
> Inigo
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/

Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Inigo Surguy <in...@hotmail.com>.
Davanum, I've created https://issues.apache.org/jira/browse/AXIS2-400 and 
attached a test AAR that reproduces the problem to it.

Ruchith, that's the structure I'm using. Accessing the contents of the AAR 
via a simple lookup from within a service works (I was wrong when I thought 
it didn't before - probably because I was doing it via a remote debug 
session). But, having the Spring library look up the contents of the AAR 
doesn't work.

The behaviour is as-if the Spring library was being added to the shared Axis 
classpath, rather than to the .AAR's classpath, but I've checked my Axis 
classpath and can't see Spring in it.

iksrazal, thanks for the suggestion. Another solution might be to explode 
the Spring jar, and put its contents as classes within the .AAR - I haven't 
tried that yet, though.

Cheers

Inigo

>From: Ruchith Fernando <ru...@gmail.com>
>Reply-To: axis-user@ws.apache.org
>To: axis-user@ws.apache.org
>Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?
>Date: Wed, 18 Jan 2006 22:03:30 +0600
>MIME-Version: 1.0
>Received: from mail.apache.org ([209.237.227.199]) by 
>bay0-mc6-f18.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 18 
>Jan 2006 08:03:53 -0800
>Received: (qmail 87128 invoked by uid 500); 18 Jan 2006 16:03:51 -0000
>Received: (qmail 87117 invoked by uid 99); 18 Jan 2006 16:03:51 -0000
>Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49)    by 
>apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jan 2006 08:03:51 -0800
>Received: pass (asf.osuosl.org: domain of ruchith.fernando@gmail.com 
>designates 64.233.162.207 as permitted sender)
>Received: from [64.233.162.207] (HELO zproxy.gmail.com) (64.233.162.207)    
>by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jan 2006 08:03:51 -0800
>Received: by zproxy.gmail.com with SMTP id 34so1556321nzf        for 
><ax...@ws.apache.org>; Wed, 18 Jan 2006 08:03:30 -0800 (PST)
>Received: by 10.65.253.11 with SMTP id f11mr4226486qbs;        Wed, 18 Jan 
>2006 08:03:30 -0800 (PST)
>Received: by 10.64.199.16 with HTTP; Wed, 18 Jan 2006 08:03:30 -0800 (PST)
>X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
>Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm
>Precedence: bulk
>list-help: <ma...@ws.apache.org>
>list-unsubscribe: <ma...@ws.apache.org>
>List-Post: <ma...@ws.apache.org>
>List-Id: <axis-user.ws.apache.org>
>Delivered-To: mailing list axis-user@ws.apache.org
>X-ASF-Spam-Status: No, hits=-0.0 required=10.0tests=SPF_PASS
>X-Spam-Check-By: apache.org
>DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;        s=beta; 
>d=gmail.com;        
>h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; 
>        
>b=Mgh9w1oFmKWVYyDnMQ5t++492x/Jc2MUYePoCWN+TxClIQp/09VJyaJnYmzDdV8bLQq1wJDF+yRZQvJxeSwBStcEKMD8gVUHUCTKEI9Qnw5XVLSHMiIs7HZK73LfGp/YXdrtN3e4o3svSVnteGlV8k8tcXB026V1zfuUlbRM8wg=
>References: <BA...@phx.gbl>
>X-Virus-Checked: Checked by ClamAV on apache.org
>Return-Path: axis-user-return-40170-inigosurguy=hotmail.com@ws.apache.org
>X-OriginalArrivalTime: 18 Jan 2006 16:03:53.0050 (UTC) 
>FILETIME=[C71E1BA0:01C61C48]
>
>Hi Inigo,
>
>Can you please try including all the libraries used by your
>application in a 'lib' directory in the .aar file. (Example: spring
>jars). And then all the resource files can be included in the .aar
>file itself.
>
>foo.aar
>   |
>  +->lib/
>   |       |
>   |      +->spring.jar
>   |      +->xyz.jar
>   |
>  +->META-INF/services.xml
>   |
>  +->bar-config.properties
>  +->bar-config1.xml
>   |
>  +->... **/*.class files of foo service
>
>This is the way we support packaging a web service and its related
>resources and libraries in a .aar. Please try it out and let us know
>if there's a problem :-)
>
>Thanks,
>Ruchith
>
>On 1/18/06, Inigo Surguy <in...@hotmail.com> wrote:
> > Hi,
> >
> > I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> > However, when Spring tries to access it's applicationContext.xml file 
>from
> > the classpath, it doesn't work. When I try to access the classpath in my 
>own
> > code, using MyObject.class.getResource() or
> > Thread.currentThread().getContextClassLoader().getResource(), I can't 
>find
> > the file either; and when I check the classloader roots of the current
> > context classloader, it only shows Tomcat
> > 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
> >
> > When I move my applicationContext.xml to the Axis WEB-INF/classes 
>directory,
> > then Spring can find it, which is consistent with the behaviour above.
> > However, it then can't load any of my application classes - presumably
> > because they're not on the classpath available to my application.
> >
> > I can presumably solve this by moving all of my code into the Axis
> > WEB-INF/lib directory - but this defeats the point of having an .aar!
> >
> > What am I doing wrong, please? How can I get the contents of the .aar 
>onto
> > the classpath of classes within that .aar?
> >
> > (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
> >
> > Cheers
> >
> > Inigo
> >
> >
> >
>
>
>--
>Ruchith



Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Ruchith Fernando <ru...@gmail.com>.
Hi Inigo,

Can you please try including all the libraries used by your
application in a 'lib' directory in the .aar file. (Example: spring
jars). And then all the resource files can be included in the .aar
file itself.

foo.aar
  |
 +->lib/
  |       |
  |      +->spring.jar
  |      +->xyz.jar
  |
 +->META-INF/services.xml
  |
 +->bar-config.properties
 +->bar-config1.xml
  |
 +->... **/*.class files of foo service

This is the way we support packaging a web service and its related
resources and libraries in a .aar. Please try it out and let us know
if there's a problem :-)

Thanks,
Ruchith

On 1/18/06, Inigo Surguy <in...@hotmail.com> wrote:
> Hi,
>
> I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
> However, when Spring tries to access it's applicationContext.xml file from
> the classpath, it doesn't work. When I try to access the classpath in my own
> code, using MyObject.class.getResource() or
> Thread.currentThread().getContextClassLoader().getResource(), I can't find
> the file either; and when I check the classloader roots of the current
> context classloader, it only shows Tomcat
> 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
>
> When I move my applicationContext.xml to the Axis WEB-INF/classes directory,
> then Spring can find it, which is consistent with the behaviour above.
> However, it then can't load any of my application classes - presumably
> because they're not on the classpath available to my application.
>
> I can presumably solve this by moving all of my code into the Axis
> WEB-INF/lib directory - but this defeats the point of having an .aar!
>
> What am I doing wrong, please? How can I get the contents of the .aar onto
> the classpath of classes within that .aar?
>
> (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
>
> Cheers
>
> Inigo
>
>
>


--
Ruchith

Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Davanum Srinivas <da...@gmail.com>.
Inigo,

clearly we need to fix this so that there are no surprises like u had.
So please log a bug so that we can debate on axis-dev@

thanks,
dims

On 1/19/06, Inigo Surguy <in...@hotmail.com> wrote:
>
> Hi Deepal,
>
> >But in Spring case as I know you can not give that guy a class loader ,
> >what it does is it gets the context class loader and try to load resources
> >from that. Since service has its own class loader you can not get service
> >resources from context class loader.
>
> Yes, that's right. Isn't the bug then that the contextClassLoader for
> a service is the WebappClassLoader rather than the DeploymentClassLoader?
> The context of the service should be the deployed .AAR, so code
> within the .AAR that loads classes and resources from the classpath will
> try to get it first from the .AAR.
>
> >In that scenario the best way is put your those resources in WEB-INF/lib in
> >that case CCL will have access to those.
>
> Yes - that would work - but it would amount to putting almost my entire
> service in the WEB-INF/lib directory, which defeats the point of having an
> .AAR in the first place.
>
> Another workaround, which is what I'm using at the moment and seems
> to work, is to explicitly set the context classloader to be the class
> classloader with:
>
> Thread.currentThread().setContextClassLoader(ClasspathTest.class.getClassLoader());
>
> Cheers
>
> Inigo
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/

Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Inigo;

yes you can set context class loader to service class loader and then 
Spring to do its job , but its not the right way unless you set the context 
class loader back to its original value.

> The context of the service should be the deployed .AAR, so code
> within the .AAR that loads classes and resources from the classpath will
> try to get it first from the .AAR.

yes , it will does so , but in your case some third person try to get 
service resources from CCL of the system. And that CCL dose not know any 
thing about service class loader.


Thanks,
 Deepal
................................................................
~Future is Open~

----- Original Message ----- 
From: "Inigo Surguy" <in...@hotmail.com>
To: <ax...@ws.apache.org>
Sent: Thursday, January 19, 2006 3:29 PM
Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?


>
> Hi Deepal,
>
>>But in Spring case as I know you can not give that guy a class loader , 
>>what it does is it gets the context class loader and try to load resources 
>>from that. Since service has its own class loader you can not get service 
>>resources from context class loader.
>
> Yes, that's right. Isn't the bug then that the contextClassLoader for
> a service is the WebappClassLoader rather than the DeploymentClassLoader?
> The context of the service should be the deployed .AAR, so code
> within the .AAR that loads classes and resources from the classpath will
> try to get it first from the .AAR.
>
>>In that scenario the best way is put your those resources in WEB-INF/lib 
>>in that case CCL will have access to those.
>
> Yes - that would work - but it would amount to putting almost my entire
> service in the WEB-INF/lib directory, which defeats the point of having an
> .AAR in the first place.
>
> Another workaround, which is what I'm using at the moment and seems
> to work, is to explicitly set the context classloader to be the class
> classloader with:
>
> Thread.currentThread().setContextClassLoader(ClasspathTest.class.getClassLoader());
>
> Cheers
>
> Inigo
>
>
> 



Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Inigo Surguy <in...@hotmail.com>.
Hi Deepal,

>But in Spring case as I know you can not give that guy a class loader , 
>what it does is it gets the context class loader and try to load resources 
>from that. Since service has its own class loader you can not get service 
>resources from context class loader.

Yes, that's right. Isn't the bug then that the contextClassLoader for
a service is the WebappClassLoader rather than the DeploymentClassLoader?
The context of the service should be the deployed .AAR, so code
within the .AAR that loads classes and resources from the classpath will
try to get it first from the .AAR.

>In that scenario the best way is put your those resources in WEB-INF/lib in 
>that case CCL will have access to those.

Yes - that would work - but it would amount to putting almost my entire
service in the WEB-INF/lib directory, which defeats the point of having an
.AAR in the first place.

Another workaround, which is what I'm using at the moment and seems
to work, is to explicitly set the context classloader to be the class
classloader with:

Thread.currentThread().setContextClassLoader(ClasspathTest.class.getClassLoader());

Cheers

Inigo



Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi;

first its not bug in Axis2 , that is because we have concept call Service 
isolation , there each service get its own classloder and which is created 
using the archive file. So if you want to get some resources in archive file 
you need to get the class loader from corresponding service and then load 
your resources.

But in Spring case as I know you can not give that guy a class loader , what 
it does is it gets the context class loader and try to load resources from 
that. Since service has its own class loader you can not get service 
resources from context class loader.

In that scenario the best way is put your those resources in WEB-INF/lib in 
that case CCL will have access to those.



Thanks,
 Deepal
................................................................
~Future is Open~

----- Original Message ----- 
From: "Inigo Surguy" <in...@hotmail.com>
To: <ax...@ws.apache.org>
Sent: Wednesday, January 18, 2006 8:55 PM
Subject: [Axis2-0.94] Classpath for Axis code running inside an .aar?


> Hi,
>
> I've deployed a .aar to Axis 2, and I'm trying to use Spring within it. 
> However, when Spring tries to access it's applicationContext.xml file from 
> the classpath, it doesn't work. When I try to access the classpath in my 
> own code, using MyObject.class.getResource() or 
> Thread.currentThread().getContextClassLoader().getResource(), I can't find 
> the file either; and when I check the classloader roots of the current 
> context classloader, it only shows Tomcat 
> 5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
>
> When I move my applicationContext.xml to the Axis WEB-INF/classes 
> directory, then Spring can find it, which is consistent with the behaviour 
> above. However, it then can't load any of my application classes - 
> presumably because they're not on the classpath available to my 
> application.
>
> I can presumably solve this by moving all of my code into the Axis 
> WEB-INF/lib directory - but this defeats the point of having an .aar!
>
> What am I doing wrong, please? How can I get the contents of the .aar onto 
> the classpath of classes within that .aar?
>
> (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
>
> Cheers
>
> Inigo
>
>
>