Can anyone point to a step-by-step tutorial on how to configure a remotely-accessible service contained within Eclipse Virgo 3.0x? I know that standards exist, etc., but I can find NO example which does not seem to contain a bunch of hand waving instead of specific steps along with working code/configurations to download. I don't care if the example uses Apache CXF, Eclipse ECF, or just about anything else. What I want is the equivalent of RMI in that both the transport and wire protocol are abstracted away behind what appears to both client and server-side developers as just plain Java (with some liberties taken).
Which bundles must be deployed into Virgo to support remoting? What Spring-ish configuration settings work? What jars must be on the client-side classpath? Etc, etc.?
I played around with Apache CXF DOSGI and got it working quite easily.
Unzip Virgo (I used the kernel distribution for simplicity), copy CXF bundle to pickup, and start Virgo:
$ 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'.
Install and run ZooKeeper server according to these instructions - I used 3.4.3. See also the ZooKeeper instructions including how to create a configuration file.
Create a file org.apache.cxf.dosgi.discovery.zookeeper.properties containing:
zookeeper.host = 127.0.0.1
and copy to pickup:
[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'.
Unzip another copy of Virgo kernel,copy the CXF bundle and org.apache.cxf.dosgi.discovery.zookeeper.properties into pickup, and start with a different JMX port:
$ bin/startup.sh -jmxport 9876
That's it, but to check that it's working, the remaining steps run the greeter sample...
Install/start the greeter interface and implementation bundles into the first Virgo instance. The simplest way is to copy the interface bundle to repository/usr and then copy the implementation bundle to pickup.
Install/start the greeter interface and client bundles into the second Virgo instance. The simplest way is to copy the interface bundle to repository/usr and then copy the client bundle to pickup.
When the "Invoke Remote Greeter Service" window appears, enter a string (e.g. "foo") into the Name field and click "Invoke".
The first Virgo instance shows the following trace log messages (in serviceability/logs/log.log):
Invoking: greetMe(foo)
The second Virgo instance shows the following trace log messages:
[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 ***
Look in the service registry of the second Virgo instance.
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]
A remote GreeterService has been published in the service registry.