axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Azazel Se <azazel...@hotmail.com>
Subject Axis2 service and spring problem, can't find Spring's ApplicationContext.
Date Thu, 02 Apr 2009 07:08:16 GMT

Hi.

I have added Axis2 and a service to a web application. I tried first with a simple echo string
method in the service which I have gotten to work. But when I add ApplicationContextHolder.getContext()
to the method there is an exception when the client tries to connect to the web service, and
Tomcat shows the error can't find Spring's ApplicationContext. When deployed to Tomcat there
was no errors. I have read about the spring axis2 integration problem and tried following
the guides (for instance on the apache axis2 site).

 

My goal is to get the context.xml so that I can send it as parameter when instantiating an
application I want to use which uses spring (  new SpringAppl sa = new SpringAppl(ApplicationContextHolder.getContext());
 ) and then use a couple of methods in that class and return a result to the client using
the service.

 

Anyone know what I am doing wrong? Exceptions and content of the files I am using are pasted
below.

 

-Az.

 

 

 

The exceptions: (The first from when I used "springappcontext.." in the services.xml and the
second when I used the "springappcontext...")

 

Caused by: java.lang.Exception: Axis2 Can't find Spring's ApplicationContext

at org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObj
ectSupplier.getServiceObject(SpringAppContextAwareObjectSupplier.java:53)
        ... 28 more

---------------------------------------------------------------------------

Caused by: org.apache.axis2.AxisFault: Axis2 Can't find Spring's ApplicationCont
ext
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObj
ectSupplier.getServiceObject(SpringAppContextAwareObjectSupplier.java:63)
        ... 28 more
Caused by: java.lang.Exception: Axis2 Can't find Spring's ApplicationContext
        at org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObj
ectSupplier.getServiceObject(SpringAppContextAwareObjectSupplier.java:53)
        ... 28 more


 

 

The java class:

---------------

. package xyz;

. import org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder;
. import org.springframework.context.ApplicationContext;

. public class MyServ {
.  public String serExe() {
.    ApplicationContext ctx = ApplicationContextHolder.getContext();
.    return "test";
. }
.}

 

 

 

The services.xml:

-----------------

<serviceGroup>
<service name="MyServ" >
 <description>
  blabla
 </description>
    <parameter name="ServiceObjectSupplier"> org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier</parameter>
   <parameter name="SpringBeanName">MyServ</parameter>
   <parameter name="ServiceClass" locked="false">xyz.MyServ</parameter>
        <operation name="serExe">
             <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
  </operation>
</service>
</serviceGroup>

 

 

The web.xml:

------------

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
 
<web-app>

 <display-name>Blabla</display-name>

 <servlet>
  <servlet-name>AxisServlet</servlet-name>
  <display-name>Apache-Axis Servlet</display-name>
  <servlet-class>
   org.apache.axis2.transport.http.AxisServlet
  </servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>

 <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
 </servlet-mapping>

 

 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/context.xml</param-value>
 </context-param>
 <context-param>
  <param-name>contextClass</param-name>
  <param-value>
   (.... path of a specific kind of WebApplicationContext class which the SpringAppl expects...)
  </param-value>
 </context-param>
 <listener>
  <listener-class>
   org.springframework.web.context.ContextLoaderListener
  </listener-class>
 </listener>

</web-app>

_________________________________________________________________
Ditt liv. Dine ting. Alt på ett sted med Windows Live™.
http://windowslive.no
Mime
View raw message