Announcement Announcement Module
Collapse
No announcement yet.
Axis2 Web Service using Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Axis2 Web Service using Spring

    Hello all:

    I have an Axis2 Web Service that makes use of Spring for managing Hibernate annotations and DAO classes. I have been looking at the Spring tutorial page of the Axis2 version 1.3 website. I am trying to figure out how to build my service's .aar file, have it deploy correctly to <Tomcat>/webapps/axis2/WEB-INF/services so that it doesn't show up as a faulty service, and have it run successfully when I connect to it from the Web Services Explorer of Eclipse. All the talk about with/without a Servlet Context, running inside/outside the AAR, etc. is very confusing. Since I am running Axis2 with Tomcat I believe that means I have access to a Servlet Context but when I configure my services.xml, applicationContext.xml, web.xml based on that path described in the tutorial I am having nothing but problems. If someone can clarify which approach is appropriate I would greatly appreciate it. Please let me know if I can provide any additional information regarding my situation.

    In addition, if any can point me to some example code and XML files that demonstrates what I am trying to do that would be greatly appreciated.

    Can someone please respond with any information as soon as possible? Thanks.

    Sincerely,
    Mike Sucena
    Software Engineer
    Last edited by msucena; Oct 16th, 2008, 05:49 PM.

  • #2
    I know this thread is a bit old, but I'm having a similar issue. After three days of working on this, I can't get Tomcat, Axis2 and Spring to all play nicely together. I'm using the Axis2 pojospringguide sample.

    I can get non-spring services running on Axis2 as a servlet in Tomcat.

    From what I understand, you add spring support to Axis2 by editing the web.xml, adding in the following lines:

    Code:
    <context-param>
    	<param-name>contextConfigLocation</param-name>
    	<param-value>/WEB-INF/hibernateSpringAxisContext.xml</param-value>
    </context-param>
    	
    <listener>
    	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    When I add this and rebuild the war, Axis2 breaks, and I get the following error from Tomcat

    Code:
    Apr 22, 2011 1:00:20 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
    java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1591)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    	at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    	at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    	at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4638)
    	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
    	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContextListener
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    	... 25 more
    Apr 22, 2011 1:00:20 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Skipped installing application listeners due to previous error(s)
    When I try to deploy the test service without the above change to web.xml, Axis2 runs, but it lists the service as faulty.

    Code:
    This Web axisService has deployment faults
    Error: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.context.support.AbstractApplicationContext.(AbstractApplicationContext.java:161) at org.springframework.context.support.AbstractRefreshableApplicationContext.(AbstractRefreshableApplicationContext.java:90) at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.(AbstractRefreshableConfigApplicationContext.java:59) at org.springframework.context.support.AbstractXmlApplicationContext.(AbstractXmlApplicationContext.java:61) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:136) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:119) at sample.spring.service.SpringInit.startUp(SpringInit.java:61) at org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(ServiceBuilder.java:518) at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:205) at org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(ServiceGroupBuilder.java:101) at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:109) at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:143) at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:81) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:659) at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144) at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:337) at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:241) at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:131) at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:284) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:559) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:448) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1189) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4935) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5262) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5257) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 34 more
    I've got all the spring jars in my axis2/lib directory and in the tomcat/lib directory. I've also got servlet-api.jar in both lib directories.

    Any help would be great.

    Thanks!

    Comment

    Working...
    X