Wso2 ESB - 生成的Java客户端错误

时间:2012-12-18 23:43:23

标签: java axis2 wso2esb ws-client

当我通过wso2esb的网页为已部署的服务生成Java客户端时,#34; Hello"。除了 HelloServiceCallBackHandler.java HelloServiceStub.java 之外,我还创建了名为 HelloClient.java 的类:

package org.wso2.cs.helloservices;
import java.rmi.RemoteException;
import org.wso2.cs.helloservices.HelloServiceStub.SayHello;
import org.wso2.cs.helloservices.HelloServiceStub.SayHelloResponse;

public class HelloClient {

public static void main(String[] args) {
    try {
        String name= new String("Test");
        HelloServiceStub stub= new HelloServiceStub();
        SayHello sh= new SayHello();
        sh.setName(name);           
        SayHelloResponse resp=stub.sayHello(sh);
        System.out.println("Response : "+resp);

    }catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
   }
 }

我有以下错误:

<font color="red"> Exception in thread "main" java.lang.NoClassDefFoundError: javax/wsdl/extensions/soap/SOAPAddress
at org.wso2.cs.helloservices.HelloServiceStub.populateAxisService(HelloServiceStub.java:41)
at org.wso2.cs.helloservices.HelloServiceStub.<init>(HelloServiceStub.java:88)
at org.wso2.cs.helloservices.HelloServiceStub.<init>(HelloServiceStub.java:77)
at org.wso2.cs.helloservices.HelloServiceStub.<init>(HelloServiceStub.java:126)
at org.wso2.cs.helloservices.HelloServiceStub.<init>(HelloServiceStub.java:118)
at org.wso2.cs.helloservices.HelloClient.main(HelloClient.java:13)
Caused by: java.lang.ClassNotFoundException: javax.wsdl.extensions.soap.SOAPAddress
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</font>

1 个答案:

答案 0 :(得分:0)

这似乎是没有找到的罐子(这抱怨wsld4j)。请将AXIS2_HOME/lib文件夹添加到程序的类路径中。