service activation by getRemoteObject not working
John (J5) Palmieri
johnp at redhat.com
Thu Apr 17 11:16:12 PDT 2008
On Thu, 2008-04-17 at 18:39 +0200, Olaf Brandt wrote:
> the service is implemented in Java as well.
> I'm at home now and can not state the exact Exception, but
> the text is like "/MyObject is not an Object provided by this service"
> I made the connection to the bus in the static block of the class.
> Then there are done some other things before aquiring the wellknown
> busname and exporting the object.
> Maybe it is better to connect to the bus right before going to export
> the object ?
> I will try tomorrow and let you hear about the results.
Sounds like you are grabbing a bus name before you have set up your
objects. We do this in Python too but being single threaded means the
object is registered before any processing of messages are done. If I
have to guess, since D-Bus Java is heavily mutli-threaded, there is a
race between when the name is added to the bus, the message is processed
and objects are registered. Matthew will know best though.
> Matthew Johnson schrieb:
> > On Thu Apr 17 17:56, Olaf Brandt wrote:
> >> I'm trying to use DBus-Java on SuSE Linux Enterprise Server 10.
> >> I'm gone use DBus to start other services.
> >> As mentioned in the Java-Doc of getRemoteObject the service should start,
> >> if the busname requested can not be found on the bus.
> >> This doesn't work. It starts not until I call a method on the
> >> Proxyobject I got.
> > It is correct that it should not start until you call a method. Possibly
> > the docs are badly worded, it's meant to read as "the resulting proxy
> > will auto start the service...".
> >> But then this method call throws an Exception, because the Object is not
> >> (in this moment) exported.
> >> If I call a second time, everything is fine, the object can be found and
> >> the methodcall returns normally.
> > This is strange. Which exception do you get and what is the service
> > implemented in. The method call won't be delivered until that process
> > connects to the bus and hence shouldn't return an exception until then.
> > It's possible there's a race condition where the message is delivered to
> > the service between connection and exporting the object. I'm not sure
> > how people normally cope with that?
> >> The dbus-daemon -version shows 0.6. Maybe the service activation is not
> >> working well in this relaese ?
> > It _should_ be fine, but that is quite an old version. If you could try
> > it with version 1.something that would be better, although I'd be
> > surprised if it made a difference.
> > Matt
John (J5) Palmieri <johnp at redhat.com>
More information about the dbus