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 Azazel Se <az...@hotmail.com> on 2009/04/01 23:13:24 UTC

Adding Axis2 service to existing web application.

I have a working web application and want to add an axis2 service to it.

The aar file I have been testing with is a simple java class with a public method which echos a string.

The service is tested and worked in axis2 standalone server and when axis2 is a web application in Tomcat (axis2.war).

 

But I cannot get it to work when trying to add the service only through my web application.

I have added the aar file to the folder "myApp.war"/WEB-INF/services/ 

It contains:

net/

    HelloEcho.class

META-INF/

    MANIFEST

    services.xml

    zzz.wsdl

 

The wsdl is auto-made by java2wsdl and the aar file is made by the service archiver codegen in eclipse.

 

I read in an article (http://www.developer.com/open/article.php/10930_3777111_2) that it could be done by adding the text written at the bottom to the web.xml file in my war which I did. I also added a dependency for axis2 (see below).

It deploys without error and the original web application works, but I cannot get the service to work. I get the error mentioned at the bottom when trying to type in http://localhost:8080/myAppl/services/zzz?wsdl . Actually I get this not matter what I write behind the services/ . But zzz is the name of the service and what I wrote in the axis2 servers so I guess the error has to do with axis2 not being properly configured? The article in the link above mentions axis2.xml in a conf/ folder in the WEB-INF, but doesn't say where it is from or what it contains..  Do I have to add more dependencies to maven or more in the web.xml file? 

Anything I have forgotten or is there an easier way to do what I want?

 

-Az.

 

Web.xml:
<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>--------------Pom.xml:<dependency>
   <groupId>org.apache.axis2</groupId>
   <artifactId>axis2</artifactId>
   <version>1.4.1</version>
</dependency>-------------Error when trying to check if service is deployed/working:javax.servlet.ServletException: Servlet.init() for servlet AxisServlet threw exception
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Thread.java:619)

root cause java.lang.NoClassDefFoundError: javax/wsdl/xml/WSDLLocator
	org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:516)
	org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Thread.java:619)

root cause java.lang.ClassNotFoundException: javax.wsdl.xml.WSDLLocator
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
	java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:516)
	org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Thread.java:619)


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

RE: Adding Axis2 service to existing web application.

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

 

> Date: Wed, 1 Apr 2009 19:09:23 -0300
> Subject: Re: Adding Axis2 service to existing web application.
> From: robertlazarski@gmail.com
> To: axis-user@ws.apache.org
> 
> On Wed, Apr 1, 2009 at 6:13 PM, Azazel Se <az...@hotmail.com> wrote:
> >
> > java.lang.ClassNotFoundException: javax.wsdl.xml.WSDLLocator
> > 
> 
> You need that class, the wsdl4j jar that was released with axis2
> should contain one. Try putting that jar in WEB-INF/lib .
> 
> - R

 

Thanks. :)

As mentioned in my mail I added the entire axis2 lib to the maven pom.xml file and thought this was enough. But as I added the jar file you mentioned to the lib I got another axis2 classnotfoundexception so I manually added all the jars to the war file and then it worked. 

 

I am new to maven, why isn't it enough to add the jars to the pom and thereby the Maven Dependencies folder/library? I thought this was the purpose for dependency, that it everything is copied when using for instance maven package?


-Az.

_________________________________________________________________
Windows Live™ Mail. Flere kontoer på ett sted.
http://download.live.com/wlmail

Re: Adding Axis2 service to existing web application.

Posted by robert lazarski <ro...@gmail.com>.
On Wed, Apr 1, 2009 at 6:13 PM, Azazel Se <az...@hotmail.com> wrote:
>
> java.lang.ClassNotFoundException: javax.wsdl.xml.WSDLLocator
> 	

You need that class, the wsdl4j jar that was released with axis2
should contain one. Try putting that jar in WEB-INF/lib .

- R

RE: Adding Axis2 service to existing web application.

Posted by Martin Gainty <mg...@hotmail.com>.
pls download wsdl4j.jar into WEB-INF/lib
http://www.java2s.com/Code/Jar/AXIS2/Downloadwsdl4j162jar.htm

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to  please inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.






From: azazel.se@hotmail.com
To: axis-user@ws.apache.org
Subject: Adding Axis2 service to existing web application.
Date: Wed, 1 Apr 2009 21:13:24 +0000








I have a working web application and want to add an axis2 service to it.

The aar file I have been testing with is a simple java class with a public method which echos a string.

The service is tested and worked in axis2 standalone server and when axis2 is a web application in Tomcat (axis2.war).

 

But I cannot get it to work when trying to add the service only through my web application.

I have added the aar file to the folder "myApp.war"/WEB-INF/services/ 

It contains:

net/

    HelloEcho.class

META-INF/

    MANIFEST

    services.xml

    zzz.wsdl

 

The wsdl is auto-made by java2wsdl and the aar file is made by the service archiver codegen in eclipse.

 

I read in an article (http://www.developer.com/open/article.php/10930_3777111_2) that it could be done by adding the text written at the bottom to the web.xml file in my war which I did. I also added a dependency for axis2 (see below).

It deploys without error and the original web application works, but I cannot get the service to work. I get the error mentioned at the bottom when trying to type in http://localhost:8080/myAppl/services/zzz?wsdl . Actually I get this not matter what I write behind the services/ . But zzz is the name of the service and what I wrote in the axis2 servers so I guess the error has to do with axis2 not being properly configured? The article in the link above mentions axis2.xml in a conf/ folder in the WEB-INF, but doesn't say where it is from or what it contains..  Do I have to add more dependencies to maven or more in the web.xml file? 

Anything I have forgotten or is there an easier way to do what I want?

 

-Az.

 

Web.xml:
<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>--------------Pom.xml:<dependency>
   <groupId>org.apache.axis2</groupId>
   <artifactId>axis2</artifactId>
   <version>1.4.1</version>
</dependency>-------------Error when trying to check if service is deployed/working:javax.servlet.ServletException: Servlet.init() for servlet AxisServlet threw exception
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Thread.java:619)

root cause java.lang.NoClassDefFoundError: javax/wsdl/xml/WSDLLocator
	org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:516)
	org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Thread.java:619)

root cause 
java.lang.ClassNotFoundException: javax.wsdl.xml.WSDLLocator
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
	java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:516)
	org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Thread.java:619)


Få gratisprogrammene fra Windows Live™. Last ned her.
_________________________________________________________________
Windows Live™: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_042009