从WSO2 ESB中调用WSO2 DSS中的服务

问题描述:

我正尝试从WSO2 ESB中的服务B向WSO2 DSS中的服务A发送消息。我生成使用JAX-WS客户端,可以访问一个直接从Java代码 ,但是当我相同的代码导出为Axis2的服务,并把它变成了ESB,我收到以下错误:从WSO2 ESB中调用WSO2 DSS中的服务

[2017-03-31 08:30:54,110] ERROR - RPCMessageReceiver  org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType; 
java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212) 
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117) 
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40) 
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) 
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) 
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395) 
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142) 
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.NoSuchMethodError: org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType; 
at service.ChangeName.echoString(ChangeName.java:27) 
at service.ChangeName.changeName(ChangeName.java:34) 
... 15 more 
[2017-03-31 08:30:54,126] ERROR - ServerWorker Error processing POST request for : /services/ChangeName.ChangeNameHttpSoap12Endpoint 
org.apache.axis2.AxisFault: org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType; 
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:208) 
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40) 
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) 
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) 
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395) 
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142) 
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212) 
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117) 
... 9 more 
Caused by: java.lang.NoSuchMethodError: org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType; 
at service.ChangeName.echoString(ChangeName.java:27) 
at service.ChangeName.changeName(ChangeName.java:34) 
... 15 more 

这是ESB以外的代码:

​​

有任何建议可以解决这个问题吗?

+1

“当我将相同的代码导出为Axis2服务并将其放入ESB时”是什么意思?既然你可以直接从突触代理调用你的DSS服务,我没有看到这样做的意义(当然除了测试)。无论如何,这个错误似乎指向你生成的客户端中缺少的类。你在ESB中将它安装在哪里? –

如果您使用生成的客户端作为“jar依赖项”,则需要将此jar添加到文件夹src/main/resources/lib 或将您的jar放到wso2esb的“dropins”文件夹中。