The Greeter example on the website is quite old.

Can you also try with the karaf based example on my website?
http://www.liquid-reality.de/x/D4C

It is much easier to install and uses the newest cxf DOSGi 1.7.0.

Christian

On 01.02.2016 10:53, Pablo Gomez wrote:
Hello all,


I've discovered recently remote services and I'm amazed about how easy to use and powerfull seems to be. However, I'm currently facing a small issue which I don't know what the reason could be. I'm testing the greeter example in two containers, one of them provides the service whereas the other consumes it. One container runs on a VirtualBox linux machine while the other runs on a windows host. I've tested with the following settings, NAT, host-only and Bridged network. Bridged network works as expected so as to physical machines connected to the same LAN do. However, with the virtual machine configured as host-only setup, I'm not able to access to it with the OSGi consumer, the activator when calling super.addingService(reference) return null. Surprisingly,I can successfully access to the service with the browser though. I do not have a deep knowledge on networks so I can't see what I am missing here. Additionally, I had faced the same issue -being able to access with the browser but not with OSGi by running the two instances, consumer and provider in the same machine and OS. In this scenario, again I can consume the service with the browser but I get null in the osgi consumer activator so I can't manage to consume successfully the service. Do you guys have a hint that helps me to understand what's going here? I'd really like to understand why this happens.

Below the  Greeter activator that I'm using in the consumer:
public class Activator implements BundleActivator {

    private ServiceTracker tracker;


    public void start(final BundleContext bc) {
tracker = new ServiceTracker(bc, GreeterService.class.getName(), null) {
            @Override
            public Object addingService(ServiceReference reference) {

                Object service = super.addingService(reference);

                if (service instanceof GreeterService) {
                    useService((GreeterService) service);
                }
                return service;
            }
        };
        tracker.open();
    }


Thank you!

regards
Pablo





--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Reply via email to