0

I'm trying to call a remote AllJoyn method on a ProxyBusObject interface but I get a ErrorReplyBusException. I can't seem to find any information about this on the API guide or on the reference documentation. Any help would be really appreciated. Here's the code and the error log. Thanks in advance.

private void connectToClient(String wellKnownName) {

    mProxyObj = mBus.getProxyBusObject(wellKnownName, OBJECT_PATH, BusAttachment.SESSION_ID_ANY, new Class[]{MyBusInterface.class});

    mMyBusInterface = mProxyObj.getInterface(MyBusInterface.class);
        String test = mMyBusInterface.doSomething();
        if (test == null) {
            Log.i(TAG, "Null");
        } else {
            Log.i(TAG, test);
        }
}

Error log:

E/AndroidRuntime: FATAL EXCEPTION: main
                                               Process: tesi.groupcast, PID: 16789
                                               java.lang.reflect.UndeclaredThrowableException
                                                   at $Proxy3.doSomething(Unknown Source)
                                                   at tesi.groupcast.MainService.connectToClient(MainService.java:188)
                                                   at tesi.groupcast.MainService.update(MainService.java:219)
                                                   at tesi.groupcast.GroupCastApp.notifyObservers(GroupCastApp.java:104)
                                                   at tesi.groupcast.GroupCastApp.newSeedNode(GroupCastApp.java:115)
                                                   at tesi.groupcast.MainGUI$1.onEditorAction(MainGUI.java:85)
                                                   at android.widget.TextView.onEditorAction(TextView.java:4483)
                                                   at com.android.internal.widget.EditableInputConnection.performEditorAction(EditableInputConnection.java:139)
                                                   at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:304)
                                                   at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:135)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5294)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at java.lang.reflect.Method.invoke(Method.java:372)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
                                                Caused by: org.alljoyn.bus.ErrorReplyBusException: org.alljoyn.Bus.Blocked
                                                   at org.alljoyn.bus.ProxyBusObject.methodCall(Native Method)
                                                   at org.alljoyn.bus.ProxyBusObject.access$300(ProxyBusObject.java:35)
                                                   at org.alljoyn.bus.ProxyBusObject$Handler.invoke(ProxyBusObject.java:264)
                                                   at java.lang.reflect.Proxy.invoke(Proxy.java:397)
                                                   at $Proxy3.doSomething(Unknown Source) 
                                                   at tesi.groupcast.MainService.connectToClient(MainService.java:188) 
                                                   at tesi.groupcast.MainService.update(MainService.java:219) 
                                                   at tesi.groupcast.GroupCastApp.notifyObservers(GroupCastApp.java:104) 
                                                   at tesi.groupcast.GroupCastApp.newSeedNode(GroupCastApp.java:115) 
                                                   at tesi.groupcast.MainGUI$1.onEditorAction(MainGUI.java:85) 
                                                   at android.widget.TextView.onEditorAction(TextView.java:4483) 
                                                   at com.android.internal.widget.EditableInputConnection.performEditorAction(EditableInputConnection.java:139) 
                                                   at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:304) 
                                                   at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:135) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:5294) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at java.lang.reflect.Method.invoke(Method.java:372) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699) 
  • Can you try adding adding mProxyObj.Introspect() before mMyBusInterface = mProxyObj.getInterface(MyBusInterface.class); – NikofTime Apr 18 '16 at 23:57

1 Answers1

1

The error is becasue the bus does not know which ProxyObject it should create becasue it is not connected to any BusObject

It is because u need to join the session before calling the proxy object. Call the

status = mBus.joinSession(busName, port, sessionID, sessionOpts, new SessionListener());

and check the status of the join session before calling the getProxyObject method and other methods.

Ajit Jain
  • 105
  • 6