Robert,

My original configuration was an aar file with all of it's libraries inside the 
lib directory of the aar file.  In addition, I was running spring within the 
aar file using a SpringInit class.  This worked very well, but now I need to 
package some servlets in the same war file as my axis2.war (which contains my 
aar).  These servlets need access to beans defined within the spring context 
which is inside the aar file.

Since the servlets are loaded by the webapp classloader and the axis2 
deployment classloader is a child of the webapp, it seems that my servlets 
won't have access to the classes (and subsequently the beans that are created) 
inside the aar file.  I tried this and it didn't work for the reasons mentioned 
above.  I then tried moving all librares from the aar file to the WEB-INF/lib 
directory which includes the spring.jar file.  This got me a little bit closer, 
but I still have the same issues.  My servlets still depend on classes that 
reside inside the aar and are unable to load them when the container starts up. 
 I am afraid that my only solution is to move these common classes into a 
different jar and put that in the WEB-INF/lib directory.  So in essence, I 
don't see a way for servlets to reference any classes that are loaded from 
within the aar file.

With that being said, I am open to suggestions.  Also, it's quite possible that 
I am doing something wrong.  Any help would be greatly appreciated.

Thanks,

John


-----Original Message-----
From: robert lazarski [mailto:[EMAIL PROTECTED]
Sent: Sat 8/11/2007 8:34 AM
To: [email protected]
Subject: Re: Axis2 Spring Question
 
If I understand you correctly, you just need to get a hold of your
beans anytime, anywhere. If you are doing Spring inside the AAR, you
already defined 'bean id="applicationContext"' . If not, you can still
make use of it. At the web-app level , axis2 uses that bean to get its
spring beans to make a Service out of it. This all takes advantage of
the Spring's ApplicationContextAware interface. Its perfectly fine for
you to use the static method that Axis2's internals use also:

http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/spring/src/org/apache/axis2/extensions/spring/receivers/SpringAppContextAwareObjectSupplier.java?view=markup

Here's some javadoc:

http://ws.apache.org/axis2/1_2/api/org/apache/axis2/extensions/spring/receivers/ApplicationContextHolder.html
http://www.springframework.org/docs/api/org/springframework/beans/factory/BeanFactory.html#getBean(java.lang.String)

HTH,
Robert

On 8/10/07, John Pfeifer <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I currently have my web services running with axis2 (1.1) and spring running
> inside the aar.  Recently I have discovered a need for servlets and/or web
> pages to get access to the objects that are in the spring context.  If I
> move spring to the WEB-INF/lib, can I do this?  The Axis2-Spring integration
> docs don't go into much detail here.  I guess what I am wondering is whether
> or not the aar files are available at the time the Spring
> ContextLoaderListener starts up.  If so, this should work.
>
>  Thanks,
>
>  John

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to