Neha
Neha

Reputation: 91

Axis2 Error - java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema

I am trying to make a simple webservice using WSDL using Axis 2 (1.7.3) and tomcat server (V6.0) while creating a webservice client I am getting this error, I have tried everything by changing the versions of server to add or delete some jar files but nothing seem to work.

I have added XMLSchema core - 2.2.1 jar file to lib folder and add it to project build path , also I add the XMLSchema file to the server config folder, but nothing to seem to work for this. I am using jdk version 1.8.0. with lower versions it still don't work and I am working Eclipse Neon. I don't know what I am missing.

Below is my WSDL which is being made at server end:

<?xml version="1.0" encoding="UTF-8"?>

  <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

  <wsdl:port binding="impl:OperatorClassSoapBinding" name="OperatorClass">

     <wsdlsoap:address location="http://localhost:8080/Testwebservice/services/OperatorClass"/>

  </wsdl:port>

I have added the picture of the error:

<This is the error, I am getting again and again>.

Upvotes: 4

Views: 21518

Answers (5)

Sotelo
Sotelo

Reputation: 1

Use a lower jdk version. Window>Preferences>Java>Installed JREs

Upvotes: -2

Devendra
Devendra

Reputation: 1884

Add woden-core-1.0M10.jar in your lib folder.

Maven :

<dependency>
    <groupId>org.apache.woden</groupId>
    <artifactId>woden-core</artifactId>
    <version>1.0M10</version>
</dependency>

Upvotes: 0

Jerome Campbell
Jerome Campbell

Reputation: 359

  1. Use AXIS 1.6.4 (instead of Latest 1.7.4)
  2. Tomcat 7
  3. Dynamic Web Project 2.5
  4. Set Axis 2 runtime location to 1.6.4 - Eclipse -> Preferences -> Web Services -> Axis 2 Preferences

Upvotes: 1

Amit Mahajan
Amit Mahajan

Reputation: 915

This is mostly due to missing dependencies. The NoClassDefError is when there are multiple versions of same class are loaded or classpath is not proper. There are many ways to solve this:

  1. Add jars one by one till transitive dependencies are resolved.
  2. Keep all jars from AXIS web application lib directory as part of AXIS_LIB library and add it as dependency.
  3. Refer maven dependencies list and add those jars with correct version and correct java/javac compiler level and runtime. Reference: axis2 maven example
  4. Create a new project using eclipse or SoapUI tool and generate a webservice from tool. This will generate the dependencies and libraries for you.

Hope this helps.

Upvotes: 0

Jens
Jens

Reputation: 69440

You have to add the xmlscema-core.jar to your classpath. You can download it here

If you use maven, add the following dependency

<!-- https://mvnrepository.com/artifact/org.apache.ws.commons.schema/XmlSchema -->
<dependency>
    <groupId>org.apache.ws.commons.schema</groupId>
    <artifactId>XmlSchema</artifactId>
    <version>1.4.7</version>
</dependency>

Upvotes: 2

Related Questions