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
--
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email. E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete, or contain viruses. The sender therefore does not accept liability
for any errors or omissions in the contents of this message, which arise as a
result of e-mail transmission.
Warning: Although the company has taken reasonable precautions to ensure no
viruses are present in this email, the company cannot accept responsibility for
any loss or damage arising from the use of this email or attachments.