> Date: Thu, 2 Apr 2009 15:01:48 -0300
> Subject: Re: Axis2 service and spring problem, can't find Spring's
> ApplicationContext.
> From: [email protected]
> To: [email protected]
>
> On Thu, Apr 2, 2009 at 1:48 PM, Azazel Se <[email protected]> wrote:
> >> From: [email protected]
> >>
> >> "ApplicationContextHolder.getContext()" isn't needed when using
> >> SpringServletContextObjectSupplier. If spring and axis2 are working
> >> together, you are done. You have to configure Spring to use
> >> ApplicationContextHolder, otherwise it will return null values.
> >>
> >> - R
> >
> >> From: [email protected]
> >> To: [email protected]
> >
> >> Here, how you try to use context .and can you provide error trace you
> >> got ....? i cant get any clue with supplied details .
> >> > . ApplicationContext ctx = ApplicationContextHolder.getContext();
> >> I don't think you need to have this line to access SpringContext
> >> explicitly , because "MyServ " is already a Spring manged bean. if you
> >> want to access any other bean inside "MyServ " use Spring injection
> >> instead of access through ApplicationContextHolder.
> >
> >
> >
> >
> > Hi, thanks for the replies.
> >
> > I have an application which I didn't make which uses spring, it has an API
> > which hides the details and preferably I don't add any more stuff to it. The
> > goal is to just use a few of the methods and get returns as normal and not
> > interact directly with spring. I have never used Spring before so my
> > knowledge about the innerworkings is small but if I get the API to work I
> > shouldn't need to either. The springappl needs the context at initiating. I
> > have tested it in a jsp file and it works, but I want to move it to a web
> > service. In the jsp file I had the same context stuff added to the web.xml
> > and this is in the jsp file:
> >
> > MyApplWithSpring ap = new
> > MyApplWithSpring(WebApplicationContextUtils.getWebApplicationContext(getServletContext()));
> >
> > This worked and I could use some of its methods afterwards.
> > So I thought it would work in the web service as well if I used
> > ApplicationContextHolder.getContext() and used new
> > MyApplWithSpring(ApplicationContextHolder.getContext()). If possible how do
> > I configure spring to use the ApplicationContextHolder so that it isn't
> > null? Or is there any other(/better) way I can do this?
> >
> > -Az.
> >
>
> So the "springappl" you didn't write requires an ApplicationContext
> reference, even though you are successfully using
> SpringServletContextObjectSupplier that doesn't really require an
> ApplicationContext reference? If so, I'll show you how to do it.
>
> - R
At the bottom are the first few lines of the code that works in eclipse. The
problems arise when wanting to deploy to axis2 and tomcat. The application I am
making a small wrapper for is very big and complex and the context.xml imports
several other xml files. The goal of the web service is to receive a string
from the client, use the application to do some stuff with a file and the
string as input, then return the results to the client. The application uses
spring, hibernate etc.
-Az.
//Create Platform.
ApplicationContext context = new
RavenAwareClassPathXmlApplicationContext("context.xml");
TavernaBaseProfile profile = new TavernaBaseProfile(context);
//Get workflow parser, load workflow.
WorkflowParser parser = profile.getWorkflowParser();
URL workflowURL = new URL("http://foo.com/workflow.xml");
Dataflow workflow = parser.createDataflow(workflowURL);
_________________________________________________________________
Windows Live™ Mail. Flere kontoer på ett sted.
http://download.live.com/wlmail