[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-user
Subject:    Problems adding Axis2 to an existing Webapp
From:       Sebastian Stein <seb.stein () hpfsc ! de>
Date:       2007-08-12 13:52:04
Message-ID: 20070812135204.GE8914 () hpfsc ! de
[Download RAW message or body]

Hi,


I have an existing webapp. Now, I want to add Axis2 to expose some classes
as web service. I can't alter the structure of the existing webapp. I added
the Axis2 libs to WEB-INF/ and I will later strip out the libs not actually
needed. At the moment the content of WEB-INF/lib is:

activation-1.1.jar                    commons-logging-1.1.jar
activation-LICENSE.txt                commons-logging-LICENSE.txt
annogen-0.1.0.jar                     geronimo-spec-jms-1.1-rc4.jar
annogen-LICENSE.txt                   geronimo-spec-jms-LICENSE.txt
axiom-api-1.2.4.jar                   jakarta-httpcore-4.0-alpha4.jar
axiom-api-LICENSE.txt                 jakarta-httpcore-LICENSE.txt
axiom-dom-1.2.4.jar                   jaxb-api-2.0.2.jar
axiom-dom-LICENSE.txt                 jaxb-impl-2.0.2.jar
axiom-impl-1.2.4.jar                  jaxb-xjc-2.0.2.jar
axiom-impl-LICENSE.txt                jaxen-1.1-beta-10.jar
axis2-adb-1.2.jar                     jaxen-LICENSE.txt
axis2-adb-codegen-1.2.jar             jettison-1.0-RC1.jar
axis2-codegen-1.2.jar                 jibx-bind-1.1.4.jar
axis2-fastinfoset-1.2.jar             jibx-run-1.1.4.jar
axis2-java2wsdl-1.2.jar               mail-1.4.jar
axis2-jaxbri-1.2.jar                  mail-LICENSE.txt
axis2-jaxws-1.2.jar                   neethi-2.0.1.jar
axis2-jaxws-api-1.2.jar               neethi-LICENSE.txt
axis2-jibx-1.2.jar                    stax-api-1.0.1.jar
axis2-json-1.2.jar                    stax-api-LICENSE.txt
axis2-kernel-1.2.jar                  stax-utils-20060915.jar
axis2-LICENSE.txt                     stax-utils-LICENSE.txt
axis2-metadata-1.2.jar                woden-1.0-incubating-M7a.jar
axis2-saaj-1.2.jar                    woden-LICENSE.txt
axis2-saaj-api-1.2.jar                wsdl4j-1.6.2.jar
axis2-soapmonitor-1.2.jar             wsdl4j-LICENSE.txt
axis2-spring-1.2.jar                  wstx-asl-3.2.1.jar
axis2-tools-1.2.jar                   wstx-LICENSE.txt
axis2-xmlbeans-1.2.jar                xalan-2.7.0.jar
backport-util-concurrent-2.2.jar      xbean-2.2.0.jar
backport-util-concurrent-LICENSE.txt  xbean-LICENSE.txt
commons-codec-1.3.jar                 xercesImpl-2.8.1.jar
commons-codec-LICENSE.txt             xercesImpl-LICENSE.txt
commons-fileupload-1.1.1.jar          xml-apis-1.3.03.jar
commons-fileupload-LICENSE.txt        xml-apis-LICENSE.txt
commons-httpclient-3.0.1.jar          XmlSchema-1.3.1.jar
commons-httpclient-LICENSE.txt        XmlSchema-LICENSE.txt
commons-io-1.2.jar

I created a small example, just consisting of a servlet and a POJO java
class, which should be exposed as web service. The webapp folder structure
looks as follows:

|-- META-INF
|-- WEB-INF
|   |-- classes
|   |   `-- de
|   |       `-- hpfsc
|   |           |-- Echo.class
|   |           `-- EchoServlet.class
|   |-- lib
|   |   |-- ...
|   |-- services
|   |   `-- Echo
|   |       |-- META-INF
|   |       |   `-- services.xml
|   `-- web.xml
`-- index.jsp

I added Axis to my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>Axis2Test</display-name>
	
	<servlet>
		<display-name>Echo Servlet</display-name>
		<servlet-name>EchoServlet</servlet-name>
		<servlet-class>de.hpfsc.EchoServlet</servlet-class>
	</servlet>	
	<servlet>
		<display-name>Apache-Axis Servlet</display-name>
		<servlet-name>AxisServlet</servlet-name>
		<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	
	<servlet-mapping>
		<servlet-name>EchoServlet</servlet-name>
		<url-pattern>/servlet/EchoServlet</url-pattern>
	</servlet-mapping>	
	<servlet-mapping>
		<servlet-name>AxisServlet</servlet-name>
		<url-pattern>/servlet/AxisServlet</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>AxisServlet</servlet-name>
		<url-pattern>*.jws</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>AxisServlet</servlet-name>
		<url-pattern>/services/*</url-pattern>
	</servlet-mapping>
	
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>

Finally, I created a services.xml file to expose de.echo.Echo class as a web
service. The content of the file looks as follows:

<?xml version="1.0" encoding="UTF-8"?>
<service name="Echo" scope="application">
     <description>EchoAxis2</description>
     <messageReceivers>
          <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
               class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
          <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
               class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
     </messageReceivers>
     <parameter name="ServiceClass">de.echo.Echo</parameter>
</service>

My first question is if there is a XML Schema file (XSD) available to
validate the services.xml file?

Now, if I deploy this complete web app on Tomcat, I get the following
exception:

12.08.2007 14:52:25 org.apache.axis2.deployment.ServiceDeployer deploy
SCHWERWIEGEND: The Echo service, which is not valid, caused Processing
Operations Modules with an error of The following error occurred during
schema generation: de.echo.Echo
org.apache.axis2.deployment.DeploymentException: Processing Operations
Modules with an error of The following error occurred during schema
generation: de.echo.Echo
        at
org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:381)
        at
org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:98)
        at
org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:175)
        at
org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:79)
        at
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:582)

...

Caused by: java.lang.ClassNotFoundException: de.echo.Echo
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at
org.apache.ws.java2wsdl.SchemaGenerator.<init>(SchemaGenerator.java:121)
        at
org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:306)
        at
org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:339)
        ... 38 more

I think the second part is more interesting, because it says that my class
de.echo.Echo can't be found. Any ideas what I'm doing wrong? Do I have to
specify somehow a path where Axis should look for class files? I'm pretty
sure it must work somehow like that, because I was able to generate such an
example webapp using Eclipse and Axis1.


Regards,


Sebastian
-- 
http://www.halle-ist-schoen.de/
City of Halle, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic