0

我正在尝试让远程 OSGi 服务与我现有的 RCP 应用程序(基于火星)一起工作。但是它似乎不起作用 - 我的应用程序的两个实例看不到另一个发布的服务。

我已将最新的 ECF SDK 添加到我的目标平台,并将以下捆绑包添加到我的产品运行时;

  • org.eclipse.ecf.discovery
  • org.eclipse.ecf.provider
  • org.eclipse.ecf.provider.remoteservice
  • org.eclipse.ecf.sharedobject
  • org.eclipse.equinox.concurrent
  • org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy
  • org.eclipse.osgi.services.remoteserviceadmin
  • org.eclipse.ecf.remoteservice.asyncproxy
  • org.eclipse.ecf.remoteservice
  • org.eclipse.ecf.osgi.services.distribution
  • org.eclipse.ecf.provider.jmdns
  • ch.ethz.iks.r_osgi.remote
  • org.eclipse.ecf.provider.r_osgi
  • org.eclipse.ecf.console
  • org.eclipse.ecf.provider.dnssd
  • org.xbill.dns
  • org.eclipse.ecf.provider.discovery

在我的一个捆绑激活器中,我有以下内容可以在 start 方法中注册我的服务()

ServiceTracker _containerManagerServiceTracker = new ServiceTracker(_context, IContainerManager.class.getName(), null);
_containerManagerServiceTracker.open();

IContainerManager containerManager = (IContainerManager) _containerManagerServiceTracker.getService();

IContainer container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer");


IMyService myService = new MyService();
Properties props = new Properties();
props.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES, IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD);
props.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS, "ecf.r_osgi.peer");
// register remote service
context.registerService(IMyService.class, myService, props);

我知道有些事情正在二审报告中起作用;

"WARNING: Port 9278 already in use. This instance of R-OSGi is running on port 9279"

我还在 zeroconf 浏览器中看到一条记录出现“_ECFOSGIRSVC”。

众多教程似乎表明该服务应该神奇地在另一个实例上可用。但是什么都没有出现(在应用程序控制台中运行“服务”只列出本地服务)。一些问题;

  • 这真的是所需要的吗?
  • 我该如何调试?
    • 我怎么知道服务是否真的被导出了?
    • 我怎么知道另一个实例是否真的在搜索它?
  • 是否可以 a) 报告容器端点并“手动”连接另一个实例?

有很多“HelloService”教程的内容并不完全相同,这让入门非常混乱!

4

1 回答 1

0

试试Riena Communication ,它在发布和绑定远程服务方面不太复杂。它使用 hessian 作为通信协议。与soap and co.相比,它真的很快,因为它的二进制协议(不是xml)

我希望这有帮助。

于 2016-05-03T09:45:28.587 回答