views:

99

answers:

0

Hello,

Im trying to create a simple web service using Axis 1.4 and Tomcat in Java. I have setup Axis 1.4, by adding the Axis jars to my CLASSPATH, also i have set AXIS_HOME. In my project folder i have two subfolders, src and classes. In src\org\test\wssample, i have SimpleCalculator.java,defined as

package org.test.wssample;

public class SimpleCalculator {

    public int add(int a, int b) {
        return a + b;
    }
    public int subtract(int a, int b) {
        return a - b;
    }
    public int multiply(int a, int b) {
        return a * b;
    }
}

In src\org\test\wssample\ws, i have created the web service interface in Calculator.java , defined as :

package org.test.wssample.ws;

public interface Calculator {
    int add (int x, int y);
    int subtract(int x, int y);
}

After,compilation i have SimpleCalculator.class in classes\org\test\wssample and Calculator.class in classes\org\test\wssample\ws.

Now, i run the following command in my classes folder to generate the WSDL file

java org.apache.axis.wsdl.Java2WSDL -o ..\calculator.wsdl -n urn:org.test.calculator -I http://localhost:9090/axis/services/calculator org.test.wssample.ws.Calculator

But,i get the errors shown below.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/di
scovery/tools/DiscoverSingleton
        at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45
)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory
.java:41)
        at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java
:33)
        at org.apache.axis.i18n.ProjectResourceBundle.<clinit>(ProjectResourceBu
ndle.java:53)
        at org.apache.axis.i18n.MessagesConstants.<clinit>(MessagesConstants.jav
a:32)
        at org.apache.axis.utils.Messages.<clinit>(Messages.java:36)
        at org.apache.axis.wsdl.Java2WSDL.<init>(Java2WSDL.java:133)
        at org.apache.axis.wsdl.Java2WSDL.main(Java2WSDL.java:680)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.discovery.tools.
DiscoverSingleton
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 9 more

Any way to fix this problem ? Thank You.