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 Ian Shafer <ia...@1321.org> on 2007/03/09 18:12:31 UTC

Loading a resource from the classpath in Axis2 with Spring

Hello,

I'm running Axis2 1.1.1 with Spring. I've got my ServiceTCCL set to 
composite (It'd be great to see some documentation on this; I know there 
are three settings, but I'm not exactly sure what each of them does). My 
problem is that I'm using iBATIS, which tries to load resources from the 
classpath. This doesn't work because it is not possible to set the 
ClassLoader that iBATIS uses (I think). (In my ServiceLifeCycle.startUp, 
I set Spring's ClassLoader like this: 
)appCtx.setClassLoader(service.getClassLoader()).

So my question is, is there a solution for this? Right now, the only 
thing I can think of is to put the resources in the servlet's 
WEB-INF/classes directory.

Also, as a side note, I am able to load the first iBATIS config file 
(because this is set in my Spring app context XML file), it's the files 
that this first config file references that cannot be read (this happens 
in iBATIS code). I tried to put all my config data in that first file, 
but iBATIS will not let you do this.

Thanks for any help,

Ian


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


Re: Loading a resource from the classpath in Axis2 with Spring

Posted by robert lazarski <ro...@gmail.com>.
I assume he's already loading spring via startUp() as the tutorial
suggests, does the idea you have add to that concept somehow ?

The issue is I was never able to get xml files via the classpath found
for hibernate inside the AAR - iBATIS and Hibernate both can be
configured via spring. So the issue is you can pass files to spring as
such:

 <property name="mappingLocations">
                   <value>classpath*:**/MyEntity.hbm.xml</value>
 </property>

Running in spring DEBUG mode with that config will show all the
classpath locations . The issue AFAICT is that I was never able to get
the lib dir inside the aar to be found by spring as a classpath
location.

Robert

On 3/9/07, Davanum Srinivas <da...@gmail.com> wrote:
> Ian,
>
> So if we enforce the ServiceTCCL/composite for startUp would that fix
> it? Please log a JIRA  enhancement issue.
>
> thanks,
> dims
>
> On 3/9/07, Ian Shafer <ia...@1321.org> wrote:
> > Hello,
> >
> > I'm running Axis2 1.1.1 with Spring. I've got my ServiceTCCL set to
> > composite (It'd be great to see some documentation on this; I know there
> > are three settings, but I'm not exactly sure what each of them does). My
> > problem is that I'm using iBATIS, which tries to load resources from the
> > classpath. This doesn't work because it is not possible to set the
> > ClassLoader that iBATIS uses (I think). (In my ServiceLifeCycle.startUp,
> > I set Spring's ClassLoader like this:
> > )appCtx.setClassLoader(service.getClassLoader()).
> >
> > So my question is, is there a solution for this? Right now, the only
> > thing I can think of is to put the resources in the servlet's
> > WEB-INF/classes directory.
> >
> > Also, as a side note, I am able to load the first iBATIS config file
> > (because this is set in my Spring app context XML file), it's the files
> > that this first config file references that cannot be read (this happens
> > in iBATIS code). I tried to put all my config data in that first file,
> > but iBATIS will not let you do this.
> >
> > Thanks for any help,
> >
> > Ian
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers
>
> ---------------------------------------------------------------------
> 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: Loading a resource from the classpath in Axis2 with Spring

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

So if we enforce the ServiceTCCL/composite for startUp would that fix
it? Please log a JIRA  enhancement issue.

thanks,
dims

On 3/9/07, Ian Shafer <ia...@1321.org> wrote:
> Hello,
>
> I'm running Axis2 1.1.1 with Spring. I've got my ServiceTCCL set to
> composite (It'd be great to see some documentation on this; I know there
> are three settings, but I'm not exactly sure what each of them does). My
> problem is that I'm using iBATIS, which tries to load resources from the
> classpath. This doesn't work because it is not possible to set the
> ClassLoader that iBATIS uses (I think). (In my ServiceLifeCycle.startUp,
> I set Spring's ClassLoader like this:
> )appCtx.setClassLoader(service.getClassLoader()).
>
> So my question is, is there a solution for this? Right now, the only
> thing I can think of is to put the resources in the servlet's
> WEB-INF/classes directory.
>
> Also, as a side note, I am able to load the first iBATIS config file
> (because this is set in my Spring app context XML file), it's the files
> that this first config file references that cannot be read (this happens
> in iBATIS code). I tried to put all my config data in that first file,
> but iBATIS will not let you do this.
>
> Thanks for any help,
>
> Ian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

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


Re: Loading a resource from the classpath in Axis2 with Spring

Posted by Martin Gainty <mg...@hotmail.com>.
Ian--

The scenario seems to manifest by which context loader you are using to load the config file
where a WebApplicationContext classLoader will favour loading from /WEB-INF
but other contexts such as ClassPathXmlApplicationContext or FileSystemXmlApplicationContext favour either locating the <config>file on CLASSPATH -or-
absolute path 
(usually specified as file:<some valid file URL path>)

Cheers,
Martin--
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Ian Shafer" <ia...@1321.org>
To: <ax...@ws.apache.org>
Sent: Friday, March 09, 2007 12:12 PM
Subject: Loading a resource from the classpath in Axis2 with Spring


> Hello,
> 
> I'm running Axis2 1.1.1 with Spring. I've got my ServiceTCCL set to 
> composite (It'd be great to see some documentation on this; I know there 
> are three settings, but I'm not exactly sure what each of them does). My 
> problem is that I'm using iBATIS, which tries to load resources from the 
> classpath. This doesn't work because it is not possible to set the 
> ClassLoader that iBATIS uses (I think). (In my ServiceLifeCycle.startUp, 
> I set Spring's ClassLoader like this: 
> )appCtx.setClassLoader(service.getClassLoader()).
> 
> So my question is, is there a solution for this? Right now, the only 
> thing I can think of is to put the resources in the servlet's 
> WEB-INF/classes directory.
> 
> Also, as a side note, I am able to load the first iBATIS config file 
> (because this is set in my Spring app context XML file), it's the files 
> that this first config file references that cannot be read (this happens 
> in iBATIS code). I tried to put all my config data in that first file, 
> but iBATIS will not let you do this.
> 
> Thanks for any help,
> 
> Ian
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
>

Re: Loading a resource from the classpath in Axis2 with Spring

Posted by Glen Mazza <gr...@verizon.net>.
Am Freitag, den 09.03.2007, 09:12 -0800 schrieb Ian Shafer:

> Also, as a side note, I am able to load the first iBATIS config file 
> (because this is set in my Spring app context XML file), it's the files 
> that this first config file references that cannot be read (this happens 
> in iBATIS code). I tried to put all my config data in that first file, 
> but iBATIS will not let you do this.
> 

There are other ways to store multiple configuration files in your app
context XML file--I don't know if you have tried this, maybe it would
help:

http://www.jroller.com/page/gmazza?entry=refactoring_the_spring_mvc_web

Glen



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