Re: [axis2] use spring configured bean inside axis2 as implementation class

2006-08-04 Thread Rajith Attapattu
Hi Anderson,Thanks for the feedback and I definitely appreciate it.Once you are free please try out the fix by Dims to the class loading issue.I guess that will take care of the main concern you have.

Also you don't have to expose your spring beans (the ones that implement the business logic) directly to leverage the spring support.also please see my comments inline.
Regards,

Rajith
On 8/3/06, Dave Andreasen  [EMAIL PROTECTED]
 wrote:




Hi Rajith,

Here is how I am putting my application together. I have a set of core services that are Spring beans. I use Hibernate as my persistence tier. The Web services layer calls a Spring service that implements the business logic.


Axis2's Spring support allows the developer to expose Spring beans as Web Services. However, I don't really want to expose my Spring beans directly as Web Services. My main motivation for this is that I can change the service interfaces without affecting my public Web services interface. I can also hide some service interfaces that are used by other services but should not be publicly available (I could also just not expose them in the WSDL too). I am also thinking it might help me with versioning down the road since I can have different Web service endpoints for different versions of my API. 

[RA] You don't have to expose your spring beans (the ones that implement the business logic) directly to leverage the spring support.You could still have the WebService that calls your core spring beans (which implements the business logic) as Spring beans. So you are not directly exposing your business logic, but still you are using spring to wire your web service with the spring beans that implement the business logic.

For examplepublic class MyWebService { private MyGreeting myGreeting;   // let spring inject the dependencypublic void setMyGreeting(myGreeting){ 
this.myGreeting = myGreeting; } public String greet(String name){ return myGreeting.greetAccordingToTheTimeOfDay(name); }}//your business logicpublic class MyGreetingImpl implements MyGreeting{ 
  public String greetAccordingToTheTimeOfDay(String name){ // if morning return Good morning  + name:   }  public String greetWithLove(String name){ 
 // . }}




My main issues with using Axis2 and Spring revolved around the Service classloader. Spring likes to use the context classloader which does not have access to the resources deployed with the service. I tried setting the classloader for Spring (one can set the classloader for the application context and the bean loader) but I ran into some problems with setting properties on Spring beans that I chalked up to permissions issues. My current workaround is ugly but it works. I deploy the Spring jars and the core services jar in the WEB-INF/lib for Axis2. My service AAR just contains the Web Service skeletons.


I do want to try the latest build. The changes in the Service classloader look promising. Unfortunately I am going on vacation for a few days after today. I am also trying to do a QA drop before I go so I am quite busy today. That means I can't try the nightly build until late next week. I would really like to not have to mess with the 
axis2.war so I am eager to try it out.

Thanks for the quick response on the issue though.

Dave




From: Rajith Attapattu [mailto:
[EMAIL PROTECTED]] Sent: Tuesday, August 01, 2006 7:50 PM
To: axis-user@ws.apache.org; 
[EMAIL PROTECTED]Subject: Re: [axis2] use spring configured bean inside axis2 as implementation class


Anderson
 ,I didn't use the extensions because they didn't apply to the approach we used for creating our Spring beans. I did create an Axis module that loads my Spring beans on Axis startup. 
Anderson if you don't mind I would like to hear about your use case about the spring bean creation. Perhaps we can improve our spring support based on your feedback.Regards,Rajith

On 7/31/06, Dave Andreasen 
[EMAIL PROTECTED] wrote:



I had the same issue. The problem is related to the Service using it's own classloader and Spring wanting to use the thread context classloader. See 
http://issues.apache.org/jira/browse/AXIS2-400. 

There have been some extensions made to support Spring in Axis2 in the nightly builds. You try pulling them down to see if they help you out. Look at JIRA issue 
http://issues.apache.org/jira/browse/AXIS2-272 for more information

I didn't use the extensions because they didn't apply to the approach we used for creating our Spring beans. I did create an Axis module that loads my Spring beans on Axis startup. 


Hope this helps!

Dave Andreasen





From: Shaowei Mao [mailto: 
[EMAIL PROTECTED]] Sent: Monday, July 31, 2006 2:59 PM
To: axis-user@ws.apache.org
Subject: [axis2] use spring configured bean inside axis2 as implementation class


Hi, I am trying to use spring configured bean by creating spring container inside skeleton generated by wsdl2java to create my own implementation class for web service, but spring container BeanFactory can't

RE: [axis2] use spring configured bean inside axis2 as implementation class

2006-08-03 Thread Dave Andreasen








Hi Rajith,



Here is how I am putting my application
together. I have a set of core services that are Spring beans. I
use Hibernate as my persistence tier. The Web services layer calls a
Spring service that implements the business logic.



Axis2s Spring support allows the
developer to expose Spring beans as Web Services. However, I dont
really want to expose my Spring beans directly as Web Services. My main
motivation for this is that I can change the service interfaces without
affecting my public Web services interface. I can also hide some service
interfaces that are used by other services but should not be publicly available
(I could also just not expose them in the WSDL too). I am also thinking
it might help me with versioning down the road since I can have different Web
service endpoints for different versions of my API. 



My main issues with using Axis2 and Spring
revolved around the Service classloader. Spring likes to use the context
classloader which does not have access to the resources deployed with the
service. I tried setting the classloader for Spring (one can set the
classloader for the application context and the bean loader) but I ran into
some problems with setting properties on Spring beans that I chalked up to
permissions issues. My current workaround is ugly but it works. I
deploy the Spring jars and the core services jar in the WEB-INF/lib for Axis2.
My service AAR just contains the Web Service
skeletons.



I do want to try the latest build.
The changes in the Service classloader look promising. Unfortunately I am going
on vacation for a few days after today. I am also trying to do a QA drop
before I go so I am quite busy today. That means I cant try the
nightly build until late next week. I would really like to not have to
mess with the axis2.war so I am eager to try it out.



Thanks for the quick response on the issue
though.



Dave









From: Rajith Attapattu
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 01, 2006
7:50 PM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: Re: [axis2] use spring
configured bean inside axis2 as implementation class





Anderson,

I didn't use the extensions because they didn't apply to the approach we
used for creating our Spring beans. I did create an Axis module that
loads my Spring beans on Axis startup. 

Anderson if you
don't mind I would like to hear about your use case about the spring bean
creation. Perhaps we can improve our spring support based on your feedback.

Regards,

Rajith



On 7/31/06, Dave
Andreasen [EMAIL PROTECTED]
wrote:







I had the same issue. The problem is related to the
Service using it's own classloader and Spring wanting to use the thread context
classloader. See http://issues.apache.org/jira/browse/AXIS2-400. 



There have been some extensions made to support Spring in
Axis2 in the nightly builds. You try pulling them down to see if they
help you out. Look at JIRA issue http://issues.apache.org/jira/browse/AXIS2-272
for more information



I didn't use the extensions because they didn't apply to the
approach we used for creating our Spring beans. I did create an Axis
module that loads my Spring beans on Axis startup. 



Hope this helps!



Dave Andreasen











From: Shaowei Mao [mailto:[EMAIL PROTECTED]]

Sent: Monday, July 31, 2006 2:59
PM
To: axis-user@ws.apache.org
Subject: [axis2] use spring configured
bean inside axis2 as implementation class









Hi, I am trying to use spring configured bean
by creating spring container inside skeleton generated by wsdl2java to create
my own implementation class for web service, but spring container BeanFactory
can't load my classes packaged inside axis2 aar file. I think this is related
to class loader aixs2 is using for each web service. Does anyone have sample
code to solve this problem?



Shaowei
Mao

aMind
Solutions LLC

Phone:
425-313-3107

Email:
[EMAIL PROTECTED]


website:
www.amindsolutions.com 






















Re: [axis2] use spring configured bean inside axis2 as implementation class

2006-08-01 Thread Davanum Srinivas

Dave,Shaowei,

If you pick up tonight's nightly, i've fixed this issue class loader
problem and you won't need the hack.

thanks,
dims

On 7/31/06, Shaowei Mao [EMAIL PROTECTED] wrote:





Dave, thanks for info. I solved class loader problem by setting current
thread context class loader. This should work for me now.



Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());



 


From: Dave Andreasen [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 31, 2006 1:11 PM
 To: axis-user@ws.apache.org; [EMAIL PROTECTED]
 Subject: RE: [axis2] use spring configured bean inside axis2 as
implementation class




I had the same issue.  The problem is related to the Service using it's own
classloader and Spring wanting to use the thread context classloader.  See
http://issues.apache.org/jira/browse/AXIS2-400.



There have been some extensions made to support Spring in Axis2 in the
nightly builds.  You try pulling them down to see if they help you out.
Look at JIRA issue
http://issues.apache.org/jira/browse/AXIS2-272 for more
information



I didn't use the extensions because they didn't apply to the approach we
used for creating our Spring beans.  I did create an Axis module that loads
my Spring beans on Axis startup.



Hope this helps!



Dave Andreasen



 


From: Shaowei Mao [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 31, 2006 2:59 PM
 To: axis-user@ws.apache.org
 Subject: [axis2] use spring configured bean inside axis2 as implementation
class



Hi, I am trying to use spring configured bean by creating spring container
inside skeleton generated by wsdl2java to create my own implementation class
for web service, but spring container BeanFactory can't load my classes
packaged inside axis2 aar file. I think this is related to class loader
aixs2 is using for each web service. Does anyone have sample code to solve
this problem?



Shaowei Mao

aMind Solutions LLC

Phone: 425-313-3107

Email: [EMAIL PROTECTED]

website: www.amindsolutions.com






--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

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



RE: [axis2] use spring configured bean inside axis2 as implementation class

2006-08-01 Thread Shaowei Mao
How did you fix it?

-Original Message-
From: Davanum Srinivas [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 01, 2006 11:34 AM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: Re: [axis2] use spring configured bean inside axis2 as
implementation class

Dave,Shaowei,

If you pick up tonight's nightly, i've fixed this issue class loader
problem and you won't need the hack.

thanks,
dims

On 7/31/06, Shaowei Mao [EMAIL PROTECTED] wrote:




 Dave, thanks for info. I solved class loader problem by setting current
 thread context class loader. This should work for me now.




Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader(
));



  


 From: Dave Andreasen [mailto:[EMAIL PROTECTED]
  Sent: Monday, July 31, 2006 1:11 PM
  To: axis-user@ws.apache.org; [EMAIL PROTECTED]
  Subject: RE: [axis2] use spring configured bean inside axis2 as
 implementation class




 I had the same issue.  The problem is related to the Service using it's
own
 classloader and Spring wanting to use the thread context classloader.  See
 http://issues.apache.org/jira/browse/AXIS2-400.



 There have been some extensions made to support Spring in Axis2 in the
 nightly builds.  You try pulling them down to see if they help you out.
 Look at JIRA issue
 http://issues.apache.org/jira/browse/AXIS2-272 for more
 information



 I didn't use the extensions because they didn't apply to the approach we
 used for creating our Spring beans.  I did create an Axis module that
loads
 my Spring beans on Axis startup.



 Hope this helps!



 Dave Andreasen



  


 From: Shaowei Mao [mailto:[EMAIL PROTECTED]
  Sent: Monday, July 31, 2006 2:59 PM
  To: axis-user@ws.apache.org
  Subject: [axis2] use spring configured bean inside axis2 as
implementation
 class



 Hi, I am trying to use spring configured bean by creating spring container
 inside skeleton generated by wsdl2java to create my own implementation
class
 for web service, but spring container BeanFactory can't load my classes
 packaged inside axis2 aar file. I think this is related to class loader
 aixs2 is using for each web service. Does anyone have sample code to solve
 this problem?



 Shaowei Mao

 aMind Solutions LLC

 Phone: 425-313-3107

 Email: [EMAIL PROTECTED]

 website: www.amindsolutions.com





-- 
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

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


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



Re: [axis2] use spring configured bean inside axis2 as implementation class

2006-08-01 Thread Davanum Srinivas

http://mail-archives.apache.org/mod_mbox/ws-axis-cvs/200608.mbox/[EMAIL 
PROTECTED]
http://mail-archives.apache.org/mod_mbox/ws-axis-cvs/200608.mbox/[EMAIL 
PROTECTED]

-- dims

On 8/1/06, Shaowei Mao [EMAIL PROTECTED] wrote:

How did you fix it?

-Original Message-
From: Davanum Srinivas [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 01, 2006 11:34 AM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: Re: [axis2] use spring configured bean inside axis2 as
implementation class

Dave,Shaowei,

If you pick up tonight's nightly, i've fixed this issue class loader
problem and you won't need the hack.

thanks,
dims

On 7/31/06, Shaowei Mao [EMAIL PROTECTED] wrote:




 Dave, thanks for info. I solved class loader problem by setting current
 thread context class loader. This should work for me now.




Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader(
));



  


 From: Dave Andreasen [mailto:[EMAIL PROTECTED]
  Sent: Monday, July 31, 2006 1:11 PM
  To: axis-user@ws.apache.org; [EMAIL PROTECTED]
  Subject: RE: [axis2] use spring configured bean inside axis2 as
 implementation class




 I had the same issue.  The problem is related to the Service using it's
own
 classloader and Spring wanting to use the thread context classloader.  See
 http://issues.apache.org/jira/browse/AXIS2-400.



 There have been some extensions made to support Spring in Axis2 in the
 nightly builds.  You try pulling them down to see if they help you out.
 Look at JIRA issue
 http://issues.apache.org/jira/browse/AXIS2-272 for more
 information



 I didn't use the extensions because they didn't apply to the approach we
 used for creating our Spring beans.  I did create an Axis module that
loads
 my Spring beans on Axis startup.



 Hope this helps!



 Dave Andreasen



  


 From: Shaowei Mao [mailto:[EMAIL PROTECTED]
  Sent: Monday, July 31, 2006 2:59 PM
  To: axis-user@ws.apache.org
  Subject: [axis2] use spring configured bean inside axis2 as
implementation
 class



 Hi, I am trying to use spring configured bean by creating spring container
 inside skeleton generated by wsdl2java to create my own implementation
class
 for web service, but spring container BeanFactory can't load my classes
 packaged inside axis2 aar file. I think this is related to class loader
 aixs2 is using for each web service. Does anyone have sample code to solve
 this problem?



 Shaowei Mao

 aMind Solutions LLC

 Phone: 425-313-3107

 Email: [EMAIL PROTECTED]

 website: www.amindsolutions.com





--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

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


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





--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

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



Re: [axis2] use spring configured bean inside axis2 as implementation class

2006-08-01 Thread Rajith Attapattu
Anderson,I didn't use the extensions because
they didn't apply to the approach we used for creating our Spring
beans. I did create an Axis module that loads my Spring beans on Axis
startup. Anderson if you don't mind I would like to hear about your use case about the spring bean creation. Perhaps we can improve our spring support based on your feedback.Regards,
RajithOn 7/31/06, Dave Andreasen [EMAIL PROTECTED] wrote:














I had the same issue. The problem is
related to the Service using it's own classloader and Spring wanting to
use the thread context classloader. See http://issues.apache.org/jira/browse/AXIS2-400.




There have been some extensions made to
support Spring in Axis2 in the nightly builds. You try pulling them down
to see if they help you out. Look at JIRA issue http://issues.apache.org/jira/browse/AXIS2-272

for more information



I didn't use the extensions because
they didn't apply to the approach we used for creating our Spring
beans. I did create an Axis module that loads my Spring beans on Axis
startup. 



Hope this helps!



Dave Andreasen











From: Shaowei Mao
[mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 31, 2006 2:59
PM
To: axis-user@ws.apache.org
Subject: [axis2] use spring
configured bean inside axis2 as implementation class





Hi, I am trying to use
spring configured bean by creating spring container inside skeleton generated
by wsdl2java to create my own implementation class for web service, but spring
container BeanFactory can't load my classes packaged inside axis2 aar file. I
think this is related to class loader aixs2 is using for each web service. Does
anyone have sample code to solve this problem?



Shaowei Mao

aMind Solutions LLC

Phone: 425-313-3107

Email: [EMAIL PROTECTED]


website: www.amindsolutions.com













RE: [axis2] use spring configured bean inside axis2 as implementation class

2006-07-31 Thread Dave Andreasen








I had the same issue. The problem is
related to the Service using its own classloader and Spring wanting to
use the thread context classloader. See http://issues.apache.org/jira/browse/AXIS2-400.




There have been some extensions made to
support Spring in Axis2 in the nightly builds. You try pulling them down
to see if they help you out. Look at JIRA issue http://issues.apache.org/jira/browse/AXIS2-272
for more information



I didnt use the extensions because
they didnt apply to the approach we used for creating our Spring
beans. I did create an Axis module that loads my Spring beans on Axis
startup. 



Hope this helps!



Dave Andreasen











From: Shaowei Mao
[mailto:[EMAIL PROTECTED] 
Sent: Monday, July 31, 2006 2:59
PM
To: axis-user@ws.apache.org
Subject: [axis2] use spring
configured bean inside axis2 as implementation class





Hi, I am trying to use
spring configured bean by creating spring container inside skeleton generated
by wsdl2java to create my own implementation class for web service, but spring
container BeanFactory can't load my classes packaged inside axis2 aar file. I
think this is related to class loader aixs2 is using for each web service. Does
anyone have sample code to solve this problem?



Shaowei Mao

aMind Solutions LLC

Phone: 425-313-3107

Email: [EMAIL PROTECTED]

website: www.amindsolutions.com










RE: [axis2] use spring configured bean inside axis2 as implementation class

2006-07-31 Thread Shaowei Mao








Dave, thanks for info. I solved class
loader problem by setting current thread context class loader. This should work
for me now.



Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());











From: Dave Andreasen
[mailto:[EMAIL PROTECTED] 
Sent: Monday, July 31, 2006 1:11
PM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: RE: [axis2] use spring
configured bean inside axis2 as implementation class





I had the same issue. The problem is
related to the Service using its own classloader and Spring wanting to
use the thread context classloader. See http://issues.apache.org/jira/browse/AXIS2-400.




There have been some extensions made to
support Spring in Axis2 in the nightly builds. You try pulling them down
to see if they help you out. Look at JIRA issue http://issues.apache.org/jira/browse/AXIS2-272
for more information



I didnt use the extensions because
they didnt apply to the approach we used for creating our Spring
beans. I did create an Axis module that loads my Spring beans on Axis
startup. 



Hope this helps!



Dave Andreasen











From: Shaowei Mao
[mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 31, 2006 2:59
PM
To: axis-user@ws.apache.org
Subject: [axis2] use spring
configured bean inside axis2 as implementation class





Hi, I am trying to use
spring configured bean by creating spring container inside skeleton generated
by wsdl2java to create my own implementation class for web service, but spring
container BeanFactory can't load my classes packaged inside axis2 aar file. I
think this is related to class loader aixs2 is using for each web service. Does
anyone have sample code to solve this problem?



Shaowei Mao

aMind Solutions LLC

Phone: 425-313-3107

Email: [EMAIL PROTECTED]

website: www.amindsolutions.com