【求助】CXF DOSGi发布的服务,远程调用报错“Error executing command:REMOTE”,但是远程Karaf中能看到endpoint

14 views
Skip to first unread message

Genghis Yang

unread,
Feb 19, 2017, 4:54:41 AM2/19/17
to cxf-zh
项目希望从OSGi转变成DOSGi的形式,分布式部署。参考官网给出的示例https://github.com/apache/cxf-dosgi/tree/master/samples/soap 在自己机器上启动了两个Karaf Container,按照页面上指导一步步操作后发现客户端Karaf找不到endpoints,于是修改了服务端Karaf的etc/org.apache.aries.rsa.discovery.zookeeper.cfgetc/org.apache.aries.rsa.discovery.zookeeper.server.cfg两个配置文件,以及客户端Karaf的etc/org.apache.aries.rsa.discovery.zookeeper.cfg,增加了zookeeper.host配置项,都配置为服务端Karaf IP地址。这样客户端Karaf可以正确找到endpoints并调用。
当我将客户端Karaf从我的机器移动到虚拟机或者其他PC上,客户端Karaf依然可以看到endpoints,但是服务调用时出错:Error executing command: REMOTE

Karaf版本4.0.8,下载解压后,只按照https://github.com/apache/cxf-dosgi/tree/master/samples/soap所述操作过。服务能够正常发布,在相同机器上启动客户端Karaf可正常调用,在远程机器的浏览器中也可以正常调用。

因为刚接触CXF和分布式服务发现,没有经验,希望大神不吝赐教,非常感谢

以下是客户端Karaf控制台输出:

karaf@root()> list
START LEVEL 100 , List Threshold: 50
ID | State | Lvl | Version | Name
--------------------------------------------------------------------------------
56 | Active | 80 | 1.9.0 | Aries Remote Service Admin Core
57 | Active | 80 | 1.9.0 | Aries Remote Service Admin Discovery Gogo Commands
58 | Active | 80 | 1.9.0 | Aries Remote Service Admin Discovery Local
59 | Active | 80 | 1.9.0 | Aries Remote Service Admin Discovery Zookeeper
60 | Active | 80 | 1.9.0 | Aries Remote Service Admin SPI
61 | Active | 80 | 1.9.0 | Aries Remote Service Admin Topology Manager
74 | Active | 80 | 2.0.0 | CXF DOSGi Common
75 | Active | 80 | 2.0.0 | CXF DOSGi Service decorator support
76 | Active | 80 | 2.0.0 | CXF DOSGi provider ws
77 | Active | 80 | 2.0.0 | CXF DOSGi Samples SOAP API
78 | Active | 80 | 2.0.0 | CXF DOSGi samples SOAP Client
84 | Active | 80 | 3.4.7 | ZooKeeper Bundle
karaf@root()> rsa:endpoints
Endpoints for framework 9c15a81e-345d-4e35-8744-da6e71bfd08d
id | interfaces | framework | comp name
--------------------------------------------------------------------------------------------------------------------------------------------
http://localhost:8181/cxf/taskservice | [org.apache.cxf.dosgi.samples.soap.TaskService] | c41377eb-8700-4dac-9996-09f710fb84b9 | TaskService
karaf@root()> rsa:endpoint http://localhost:8181/cxf/taskservice
key                                                        | value                                          
------------------------------------------------------------------------------------------------------------
component.id                                               | 4                                              
component.name                                             | TaskService                                    
endpoint.framework.uuid                                    | c41377eb-8700-4dac-9996-09f710fb84b9           
endpoint.id                                                | http://localhost:8181/cxf/taskservice          
endpoint.package.version.org.apache.cxf.dosgi.samples.soap | 2.0.0                                          
endpoint.service.id                                        | 166                                            
objectClass                                                | [org.apache.cxf.dosgi.samples.soap.TaskService]
org.apache.cxf.ws.address                                  | http://localhost:8181/cxf/taskservice          
service.bundleid                                           | 232                                            
service.imported                                           | true                                           
service.imported.configs                                   | [org.apache.cxf.ws]                            
service.intents                                            | []                                             
service.scope                                              | bundle   
karaf@root()> task:list
Open tasks:
Error executing command: REMOTE
karaf@root()> 

client端服务调用者配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.apache.cxf.dosgi.samples.soap.client.TaskServiceCommand">
  <implementation class="org.apache.cxf.dosgi.samples.soap.client.TaskServiceCommand"/>
  <service>
    <provide interface="org.apache.cxf.dosgi.samples.soap.client.TaskServiceCommand"/>
  </service>
  <reference name="TaskService" interface="org.apache.cxf.dosgi.samples.soap.TaskService" bind="setTaskService"/>
  <property name="osgi.command.function" type="String">list
add
delete</property>
  <property name="osgi.command.scope" type="String" value="task"/>
</scr:component>

Reply all
Reply to author
Forward
0 new messages