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 "Joey S." <jo...@hotmail.com> on 2009/03/31 21:40:59 UTC

Spring application made available as a web service through Axis2

Hi.

I have an application which I want to build a small wrapper around and make a couple of the methods available as a web service in Axis2. I don't know much about the inner workings of it, but it uses spring, hibernate etc which makes it abit difficult. It expects the context.xml file as parameter when instatiated. I have made the web.xml as in the axis2-spring tutorial:

 

<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>context.xml</param-value>
</context-param>

 

And as a test I made a jsp file with the following startcode to see that it worked:
Application ap = new Application(WebApplicationContextUtils.getWebApplicationContext(getServletContext()));
....


It works as wanted, but as mentioned I want it available as a web service. Considering all the problems with Spring and Axis2 together what is the easiest way to make a web service out off it? I have used quite some time trying the different stuff from the tutorial, but cannot get it to work.

 

-Joey


_________________________________________________________________
Mest sett denne måneden på MSN Video.
http://video.msn.com/?mkt=nb-no&from=HMTAG

Re: Spring application made available as a web service through Axis2

Posted by robert lazarski <ro...@gmail.com>.
On Tue, Mar 31, 2009 at 6:43 PM, robert lazarski
<ro...@gmail.com> wrote:
> - Show quoted text -
>
> And instantiate it somehow and log its output. A servlet with
> load-on-startup is one common way, your app may have another. If the
> missing class is actually a Service class, or you want to see the
> entire classloader layout, this link may show you its location:
>
> http://localhost:8080/penguin/axis2-web/HappyAxis.jsp
>
> - R
>

On your system that could be:

http://localhost:8080/axis2/axis2-web/HappyAxis.jsp

- R

Re: Spring application made available as a web service through Axis2

Posted by robert lazarski <ro...@gmail.com>.
- Show quoted text -

On Tue, Mar 31, 2009 at 5:50 PM, Azazel Se <az...@hotmail.com> wrote:
> Hi again.
> Everything which has something to do with the spring application, including
> the apllication, are in jars and placed in the WEB-INF/lib folder.
> The context xml files are filled with bean id and properties which are used
> by the springapplication. The only thing I need from it I get through the
> 'main' api class. I'm completely new to spring so the idea was to hide it
> behind a thin wrapper.
>
> -Joey.

The error you get, "ClassNotFoundException: net.de.impl.WpiImpl" , is
clearly saying that class is not in your classloader somehow. I'd
check thoroughly that its where you think it is.

If you're still stuck, and the app is running but axis2 / spring are
not, try putting this in net.de.impl.WpiImpl:

this.getClass().getProtectionDomain().getCodeSource().getLocation());

And instantiate it somehow and log its output. A servlet with
load-on-startup is one common way, your app may have another. If the
missing class is actually a Service class, or you want to see the
entire classloader layout, this link may show you its location:

http://localhost:8080/penguin/axis2-web/HappyAxis.jsp

- R

RE: Spring application made available as a web service through Axis2

Posted by Azazel Se <az...@hotmail.com>.
Hi again.

Everything which has something to do with the spring application, including the apllication, are in jars and placed in the WEB-INF/lib folder.

The context xml files are filled with bean id and properties which are used by the springapplication. The only thing I need from it I get through the 'main' api class. I'm completely new to spring so the idea was to hide it behind a thin wrapper.

 

-Joey.

 

> Date: Tue, 31 Mar 2009 17:39:16 -0300
> Subject: Re: Spring application made available as a web service through Axis2
> From: robertlazarski@gmail.com
> To: axis-user@ws.apache.org
> 
> On Tue, Mar 31, 2009 at 5:30 PM, Azazel Se <az...@hotmail.com> wrote:
> > SEVERE: Exception sending context initialized event to listener instance of
> > class org.springframework.web.context.ContextLoaderListener
> > org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find
> > class [--springappl---] for bean with name 'appl.rted.Wpi' defined in
> > ServletContext resource [/WEB-INF/context-parts/basic-profile.xml]; nested
> > exception is java.lang.ClassNotFoundException: net.de.impl.WpiImpl
> > Caused by: java.lang.ClassNotFoundException: net.de.impl.wpiImpl
> 
> Um, maybe put net.de.impl.WpiImpl in WEB_INF/classes or if its in a
> jar, put the jar in WEB_INF/lib ?
> 
> - R


_________________________________________________________________
Få Windows Live Messenger på mobilen.
http://windowslivemobile.msn.com/Homepage.aspx?lang=nb-no&ocid=30032

Re: Spring application made available as a web service through Axis2

Posted by robert lazarski <ro...@gmail.com>.
On Tue, Mar 31, 2009 at 5:30 PM, Azazel Se <az...@hotmail.com> wrote:
> SEVERE: Exception sending context initialized event to listener instance of
> class org.springframework.web.context.ContextLoaderListener
> org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find
> class [--springappl---] for bean with name 'appl.rted.Wpi' defined in
> ServletContext resource [/WEB-INF/context-parts/basic-profile.xml]; nested
> exception is java.lang.ClassNotFoundException: net.de.impl.WpiImpl
> Caused by: java.lang.ClassNotFoundException: net.de.impl.wpiImpl

Um, maybe put net.de.impl.WpiImpl in WEB_INF/classes or if its in a
jar, put the jar in WEB_INF/lib ?

- R

RE: Spring application made available as a web service through Axis2

Posted by Azazel Se <az...@hotmail.com>.
Sorry. Yes I have been using the axis guides at the apache site, for instance: http://ws.apache.org/axis2/1_3/spring.html

Last two attempts I tried with SpringServletContextObjectSupplier first and then SpringAppContextAwareObjectSupplier in the services.xml file.

And tried to get the context into the web service class and instatiated the spring application with through org.springframework.context.ApplicationContext and the method ApplicationContextHolder.getContext().

I then got the error below.

I've tried a few different layouts. Last times:

 

WEB-INF/
.     classes/
..              mApp/

...                  myAppl.class
.      context-parts/
..              -several context xml files
.      lib/ 
..             -spring axis etc etc
.      services/ 
.      wSer/
..               services.xml
.      context.xml  (imports from the xml to the context folder)
.      plat.properties
.      web.xml

 

 

org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [--springappl---] for bean with name 'appl.rted.Wpi' defined in ServletContext resource [/WEB-INF/context-parts/basic-profile.xml]; nested exception is java.lang.ClassNotFoundException: net.de.impl.WpiImpl
Caused by: java.lang.ClassNotFoundException: net.de.impl.wpiImpl
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
 at org.springframework.util.ClassUtils.forName(ClassUtils.java:201)
 at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:325)
 at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1033)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:274)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:360)
 at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:241)
 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
 at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1247)
 at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:604)
 at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:129)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:619)
 
> Date: Tue, 31 Mar 2009 17:01:32 -0300
> Subject: Re: Spring application made available as a web service through Axis2
> From: robertlazarski@gmail.com
> To: axis-user@ws.apache.org
> 
> On Tue, Mar 31, 2009 at 4:40 PM, Joey S. <jo...@hotmail.com> wrote:
> >
> > It works as wanted, but as mentioned I want it available as a web service.
> > Considering all the problems with Spring and Axis2 together what is the
> > easiest way to make a web service out off it? I have used quite some time
> > trying the different stuff from the tutorial, but cannot get it to work.
> >
> > -Joey
> >
> 
> You mean the spring / axis2 tutorial at the axis2 site? If you could
> be more specific than "but cannot get it to work" maybe we can help.
> If you already have spring up, getting it plugged into axis2 isn't
> much harder.
> 
> - R

_________________________________________________________________
Dobbelt så moro – del bilder med andre mens du chatter på Windows Live Messenger.
http://www.microsoft.com/windows/windowslive/products/messenger.aspx

Re: Spring application made available as a web service through Axis2

Posted by robert lazarski <ro...@gmail.com>.
On Tue, Mar 31, 2009 at 4:40 PM, Joey S. <jo...@hotmail.com> wrote:
>
> It works as wanted, but as mentioned I want it available as a web service.
> Considering all the problems with Spring and Axis2 together what is the
> easiest way to make a web service out off it? I have used quite some time
> trying the different stuff from the tutorial, but cannot get it to work.
>
> -Joey
>

You mean the spring / axis2 tutorial at the axis2 site? If you could
be more specific than "but cannot get it to work" maybe we can help.
If you already have spring up, getting it plugged into axis2 isn't
much harder.

- R