Revision history [back]

click to hide/show revision 1
initial version

MarshalBusException with InstantiationException, Android and Java

I am trying to send a class between an Android application and a Java application running on a desktop. When I submit the data from the phone to the server, I receive the following error on the phone:

11-17 16:13:55.277: E/PERMISSION_MGR(2945):  267.553 ****** ERROR PERMISSION_MGR lepDisp    ...ndroid/PermissionDB.cc:202 | Failed to open /data/system/packages.xml: ER_FAIL
11-17 16:14:09.340: E/SimpleClient(2945): SimpleClient.sendBids(): org.alljoyn.bus.ErrorReplyBusException: org.alljoyn.Bus.ErStatus
11-17 16:14:09.340: E/SimpleClient(2945): org.alljoyn.bus.ErrorReplyBusException: org.alljoyn.Bus.ErStatus
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.ProxyBusObject.methodCall(Native Method)
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.ProxyBusObject.access$300(ProxyBusObject.java:36)
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.ProxyBusObject$Handler.invoke(ProxyBusObject.java:241)
11-17 16:14:09.340: E/SimpleClient(2945):   at $Proxy1.sendBids(Native Method)
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.samples.simpleclient.MainActivity$BusHandler.handleMessage(MainActivity.java:344)
11-17 16:14:09.340: E/SimpleClient(2945):   at android.os.Handler.dispatchMessage(Handler.java:99)
11-17 16:14:09.340: E/SimpleClient(2945):   at android.os.Looper.loop(Looper.java:137)
11-17 16:14:09.340: E/SimpleClient(2945):   at android.os.HandlerThread.run(HandlerThread.java:60)

And the following error message at the server:

24.938 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 | org.alljoyn.bus.MarshalBusException: cannot marshal '(aiibi)' into class org.alljoyn.bus.samples.ClientBid
  24.940 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:353)
  24.940 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:377)
  24.940 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 | Caused by: java.lang.InstantiationException: org.alljoyn.bus.samples.ClientBid
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at java.lang.Class.newInstance0(Class.java:342)
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at java.lang.Class.newInstance(Class.java:310)
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:313)
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:377)

I'm having trouble debugging the problem, because I'm not sure which issue is happening first. I suspect the issue is originating at the server, but there's nothing wrong with the associated class where the error is evidently occurring.

I'm not sure what to do. Any ideas?

MarshalBusException with InstantiationException, Android and Java

I am trying to send a class between an Android application and a Java application running on a desktop. When I submit the data from the phone to the server, I receive the following error on the phone:

11-17 16:13:55.277: E/PERMISSION_MGR(2945):  267.553 ****** ERROR PERMISSION_MGR lepDisp    ...ndroid/PermissionDB.cc:202 | Failed to open /data/system/packages.xml: ER_FAIL
11-17 16:14:09.340: E/SimpleClient(2945): SimpleClient.sendBids(): org.alljoyn.bus.ErrorReplyBusException: org.alljoyn.Bus.ErStatus
11-17 16:14:09.340: E/SimpleClient(2945): org.alljoyn.bus.ErrorReplyBusException: org.alljoyn.Bus.ErStatus
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.ProxyBusObject.methodCall(Native Method)
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.ProxyBusObject.access$300(ProxyBusObject.java:36)
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.ProxyBusObject$Handler.invoke(ProxyBusObject.java:241)
11-17 16:14:09.340: E/SimpleClient(2945):   at $Proxy1.sendBids(Native Method)
11-17 16:14:09.340: E/SimpleClient(2945):   at org.alljoyn.bus.samples.simpleclient.MainActivity$BusHandler.handleMessage(MainActivity.java:344)
11-17 16:14:09.340: E/SimpleClient(2945):   at android.os.Handler.dispatchMessage(Handler.java:99)
11-17 16:14:09.340: E/SimpleClient(2945):   at android.os.Looper.loop(Looper.java:137)
11-17 16:14:09.340: E/SimpleClient(2945):   at android.os.HandlerThread.run(HandlerThread.java:60)

And the following error message at the server:

24.938 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 | org.alljoyn.bus.MarshalBusException: cannot marshal '(aiibi)' into class org.alljoyn.bus.samples.ClientBid
  24.940 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:353)
  24.940 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:377)
  24.940 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 | Caused by: java.lang.InstantiationException: org.alljoyn.bus.samples.ClientBid
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at java.lang.Class.newInstance0(Class.java:342)
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at java.lang.Class.newInstance(Class.java:310)
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:313)
  24.941 ****** ERROR ALLJOYN_JAVA lepDisp      ...a/jni/alljoyn_java.cc:9946 |     at org.alljoyn.bus.MsgArg.unmarshal(MsgArg.java:377)

I'm having trouble debugging the problem, because I'm not sure which issue is happening first. I suspect the issue is originating at the server, but there's nothing wrong with the associated class where the error is evidently occurring.

Here is the interface I'm using:

@BusInterface (name = "org.sample.busMethods")
public interface SampleInterface {  
    @BusMethod
    public void sendBids(ClientBid cb) throws BusException;
}

and the class:

public class ClientBid {    
    @Position(0) public int[] bids;
    @Position(1) public int sessionId;
    @Position(2) public boolean pcc;
    @Position(3) public int onInterruption;

    public ClientBid(int[] bids, int sessionId, boolean pcc, int onInterruption) {
        this.bids = bids;
        this.sessionId = sessionId;
        this.pcc = pcc;
        this.onInterruption = onInterruption;
    }
}

I have tried to manually include the signature (aiibi) in the interface, with no effect. I circumvented the issue by just passing the parameters directly, without including them in a class, but I'm not sure what to do. Any ideas?I was doing incorrectly in the first place.