This discussion is archived
0 Replies Latest reply: Sep 13, 2012 12:00 AM by 961728 RSS

Shareable: lookupAID returns AID, getAppletShareableInterface returns null

961728 Newbie
Currently Being Moderated
Hello everyone,

I'm new to Javacard development and I can't get my Shareable interface to work.

I have an interface class declaring a function my client applet wants to use. My server applet implements this class. My client applet looks up the AID and tries to acquire the interface by calling getAppletShareableInterface. But this always returns null.

My server applet's getShareableInterface consists of just 'return this;', so I guess the fault lies elsewhere. But I have no idea where.

I'm using the JCWDE and stepping through the code I see that my server applet calls register so the client applet should be able to find it. Can anyone give me some pointers what could be going wrong?

Thanks,
Alex

edit: Found the mistake. I tried to initialize the Shareable object in the constructor. At that time the client's register method is not yet called, so the JCRE doesn't have its AID. While my server's getShareableInterfaceObject(AID clientaid, byte parameter) method doesn't require the client's AID to be != null the JCRE probably does, since it calls this method for my client. I now initialize my Shareable object when I process my first APDU and it now works.

Edited by: a.peganz on Sep 12, 2012 11:54 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points