1
votes

I am using WSO2 Dev Studio 3.5, I have used Generate Axis2 Web Service Client feature to generate new Axis2 Client. The Dev Studio created new Project and generated Stub for me, but I don't know how to utilize this Stub. I created new class in the same package with generated stub and tried 2 way below, but it all introduced error:

AdderStub stub = new AdderStub()

Error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/wsdl/WSDLException
    at axis2.adder.AdderStub.populateAxisService(AdderStub.java:41)
    at axis2.adder.AdderStub.<init>(AdderStub.java:88)
    at axis2.adder.AdderStub.<init>(AdderStub.java:77)
    at axis2.adder.AdderStub.<init>(AdderStub.java:126)
    at axis2.adder.AdderStub.<init>(AdderStub.java:118)
    at axis2.adder.TestAdder.main(TestAdder.java:19)
Caused by: java.lang.ClassNotFoundException: javax.wsdl.WSDLException
    at java.net.URLClassLoader$1.run(Unknown Source)
    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)
    ... 6 more


AdderStub stub = new AdderStub(null, "http://localhost:9763/services/Adder");

Error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/utils/NamespacePrefixList
    at axis2.adder.AdderStub.populateAxisService(AdderStub.java:41)
    at axis2.adder.AdderStub.<init>(AdderStub.java:88)
    at axis2.adder.AdderStub.<init>(AdderStub.java:77)
    at axis2.adder.TestAdder.main(TestAdder.java:19)
Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.utils.NamespacePrefixList
    at java.net.URLClassLoader$1.run(Unknown Source)
    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)
    ... 4 more

Could you please help me to utilized Axis2 Client code generated by WSO2 Dev Studio? thanks.

Regards, Trong

1

1 Answers

-1
votes

This looks like an issue with Java classpath of this project. Typically, the needed dependency jar list can be found in pom.xml or in case of Ant, in build.xml. You need to include these when running your main class. For ex. the first error is because the wsdl4j jar was missing in the classpath.