D-Bus in Java problem

Martin Homuth martin.homuth at googlemail.com
Fri Jul 12 08:16:21 PDT 2013


Thanks for your reply!

For some reason I did not define the interface class, a simple
CreateInterface on the .xml from the daemon (and some structural
adjustments) solved the problem  and it works flawlessly now.

FYI, there was no additional information in the error message, I
pasted the whole output.

Regards,
Martin

On 7/12/2013 4:19 PM, Matthew Johnson wrote:
> On Wed Jul 10 14:57, Martin H wrote:
>> Hi, I am trying to communicate with a C++ Qt D-Bus daemon with a
>> java program to call a method, which returns a string. First I
>> checked the actual availability of the method via D-Bus with the
>> tool D-Feet. So I am able to call the method with this tool and I
>> receive the result I expect.
>> 
>> The problem is, when I use dbus-java-2.7, I get the following
>> error:
>> 
>> org.freedesktop.dbus.exceptions.DBusExecutionException: 
>> com.sun.proxy.$Proxy2.get_perf_data(org.freedesktop.dbus.UInt64, 
>> org.freedesktop.dbus.UInt64) at
>> org.freedesktop.dbus.AbstractConnection.callMethodAsync(Unknown 
>> Source) at 
>> de.tuberlin.kbs.performancemonitor.DataThread.retrieveDataFromDBus(DataThread.java:123)
>>
>> 
at de.tuberlin.kbs.performancemonitor.DataThread.run(DataThread.java:59)
>> at java.lang.Thread.run(Thread.java:722)
>> 
>> It is kind of obvious, that the "Unknown Source" might be the
>> problem, but I am hopelessly lost trying to determine the reason
>> for this. For creation of the connection and the interface I use
>> the following:
> 
> Unknown Source here just says that it was compiled without debug
> symbols.
> 
>> UInt64 from = new UInt64(0); UInt64 to = new UInt64(0); 
>> dBusConnection =
>> DBusConnection.getConnection(DBusConnection.SESSION); 
>> dBusInterface = 
>> dBusConnection.getPeerRemoteObject("de.tuberlin.kbs.performancemonitor",
>>
>> 
"/");
>> if(dBusInterface.isRemote()) 
>> dBusConnection.callMethodAsync(dBusInterface, 
>> "get_perf_data",from,to);
> 
>> The object IS remote and the method call produces the mentioned
>> error.
> 
> Out of interest, why are you using callMethodAsync rather than a
> synchronous call? Have you defined the java class matching your
> Interface?
> 
> MyInterface mi = (MyInterface)
> dbusConnection.getPeerRemoteObject(....); mi.get_perf_data(from,
> to) would be the normal way to call here.
> 
> I can't remember if callMethodAsync works without a defined
> interface available, so that could be the problem.
> 
> Was there any other error message in the Exception? I'd expect
> something else. Did you miss something in your paste?
> 
> Thanks, Matt
> 


More information about the dbus mailing list