有人能指出如何配置Eclipse Virgo 3.0x中包含的可远程访问的服务的分步教程吗?我知道标准存在等等,但我可以找到没有示例,似乎没有包含一堆手挥动而不是特定的步骤以及下载的工作代码/配置。我不在乎该示例是使用Apache CXF,Eclipse ECF还是其他任何内容。我想要的是相当于RMI,因为传输和有线协议都被抽象出来,只有客户端和服务器端开发人员看来只是简单的Java(有一些自由)。
必须将哪些捆绑包部署到处女座以支持远程处理?什么Spring-ish配置设置有效?客户端类路径上必须有哪些jar?等等?
答案 0 :(得分:4)
我使用Apache CXF DOSGI并且很容易使用它。
解压Virgo(为简单起见,我使用了内核发行版),将CXF包复制到拾取,然后启动处女座:
$ bin/startup.sh
[2012-04-04 14:17:33.011] startup-tracker <KE0001I> Kernel starting.
[2012-04-04 14:17:36.135] startup-tracker <KE0002I> Kernel started.
...
[2012-04-04 14:17:38.561] sync Event Dispatcher Thread <UR0001I> User region ready.
[2012-04-04 14:17:39.565] fs-watcher <HD0001I> Hot deployer processing 'INITIAL' event for file 'cxf-dosgi-ri-singlebundle-distribution-1.3.jar'.
[2012-04-04 14:17:40.060] fs-watcher <DE0000I> Installing bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'.
[2012-04-04 14:17:40.570] fs-watcher <DE0001I> Installed bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'.
[2012-04-04 14:17:40.593] fs-watcher <DE0004I> Starting bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'.
[2012-04-04 14:17:43.498] start-signalling-1 <DE0005I> Started bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'.
根据these instructions安装并运行ZooKeeper服务器 - 我使用的是3.4.3。另请参阅ZooKeeper instructions,包括如何创建配置文件。
创建一个包含以下内容的文件org.apache.cxf.dosgi.discovery.zookeeper.properties:
zookeeper.host = 127.0.0.1
并复制到皮卡:
[2012-04-04 14:29:51.385] fs-watcher <HD0001I> Hot deployer processing 'CREATED' event for file 'org.apache.cxf.dosgi.discovery.zookeeper.properties'.
[2012-04-04 14:29:51.417] fs-watcher <DE0000I> Installing configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'.
[2012-04-04 14:29:51.428] fs-watcher <DE0001I> Installed configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'.
[2012-04-04 14:29:51.434] fs-watcher <DE0004I> Starting configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'.
[2012-04-04 14:29:51.439] fs-watcher <DE0005I> Started configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'.
解压缩Virgo内核的另一个副本,将CXF软件包和org.apache.cxf.dosgi.discovery.zookeeper.properties复制到拾取中,并从另一个JMX端口开始:
$ bin/startup.sh -jmxport 9876
就是这样,但为了检查它是否正常工作,剩下的步骤会运行绿色样本......
在第一个Virgo实例中安装/启动greeter interface和implementation个包。最简单的方法是将接口包复制到repository / usr,然后将实现包复制到拾取。
在第二个Virgo实例中安装/启动greeter interface和client个包。最简单的方法是将接口包复制到repository / usr,然后将客户端包复制到拾取。
当出现“调用远程Greeter服务”窗口时,在名称字段中输入一个字符串(例如“foo”),然后单击“调用”。
第一个Virgo实例显示以下跟踪日志消息(在serviceability / logs / log.log中):
Invoking: greetMe(foo)
第二个Virgo实例显示以下跟踪日志消息:
[2012-04-05 14:14:56.766] INFO Thread-29 System.out *** Invoking greeter ***
[2012-04-05 14:14:56.970] INFO Thread-29 System.out greetMe("foo") returns:
[2012-04-05 14:14:56.971] INFO Thread-29 System.out Hola foo
[2012-04-05 14:14:56.971] INFO Thread-29 System.out Bonjour foo
[2012-04-05 14:14:56.972] INFO Thread-29 System.out Hoi foo
[2012-04-05 14:14:56.972] INFO Thread-29 System.out Hello foo
[2012-04-05 14:14:56.972] INFO Thread-29 System.out *** Opening greeter client dialog ***
查看第二个Virgo实例的服务注册表。
osgi> vsh:service examine 245
Properties:
endpoint.id:
http://localhost:9090/greeter
objectClass:
org.apache.cxf.dosgi.samples.greeter.GreeterService
service.id:
245
service.imported:
true
service.imported.configs:
org.apache.cxf.ws
Publisher: cxf-dosgi-ri-singlebundle-distribution 1.3.0 [84]
Consumer(s):
cxf-dosgi-ri-samples-greeter-client 1.2.0 [86]
远程GreeterService已在服务注册表中发布。
答案 1 :(得分:2)
这可能不是您正在寻找的,但我完全有理由相信Enterprise OSGi in Action中远程服务章节中的说明应该与处女座合作。