Java DBus Namespace problem.

Arigead captain.deadly at gmail.com
Tue Mar 2 01:40:11 PST 2010


Matthew Johnson wrote:
> On Tue Mar 02 09:12, Arigead wrote:
>> Sorry to post again, but I'm afraid I'm the bearer of bad tidings I
>> tried the nested interface example and Eclipse wasn't too happy with that:
>>
>> The nested type navit cannot hide an enclosing type
> 
> Ah, that's interesting. I admit I've not tried it with the names being the same
> 
>> The other method of using the annotation to correct the class name gives
>> me a problem at runtime when casting:
>>
>> nav n = (nav) dbusConnection.getRemoteObject(NavitBusName, NavitPath);
>>
>> Caused by: java.lang.ClassCastException: $Proxy6 cannot be cast to
>> org.navit_project.nav
>>
>> if I change the name to navit n= (navit)
>> dbusConnection.getRemoteObject() it's happy.
> 
> Hmm, try passing the class explicitly to dbusConnection.getRemoteObject. When
> you use the version without the class it introspects the given path to work out
> which interfaces it supports. Sounds like that path does not claim to support
> that interface.
> 
> Matt

I think that the path does support the interface as I started with

package org.navit_project;

public interface navit extends DBusInterface{
    public Path attr_iter();
}

That allowed me to get a handle on the object with:

navit n = (navit) dbusConnection.getRemoteObject(NavitBusName, NavitPath);

and call the method in the interface. When I change to using the wrong
Interface name and allow the annotation to correct:

package org.navit_project;

@DBusInterfaceName("org.navit_project.navit")
public interface nav extends DBusInterface{
    public Path attr_iter();
}

It's failing the cast at run time.

nav n = (nav) dbusConnection.getRemoteObject(NavitBusName, NavitPath);

I'm sure there's a way around this :-(


More information about the dbus mailing list