Java Gateway mapping of streams
Hi All,
I'm trying to create a simple wrapper class around a JSON schema validator library, written in Java, and calling this functionality through the Java Gateway of IRIS 2019.1.
My Java wrapper class has a constructor like this:
public JSONValidator(char[] jsonStream, char[] schemaStream) { ... }
According to the documentation this should be called with %GlobalCharacterStream arguments from the IRIS side. So I open the two files, containing my JSON-serialized object and JSON schema definition and I copy their contents into %GlobalCharacterStream objects. Then I call the above mentioned contructor:
set validator = ##class(demo.cashreg.json.JSONValidator).%New(gateway, jsonStreamGL, schemaStreamGL)
And I'm getting the following Java exception:
ERROR #5023: Remote Gateway Error: java.lang.ClassNotFoundException: 184 ...
Where 184 is actually the length of the first stream, which I'm passing to the Java side. Modifying the stream changes this number accordingly, so I'm pretty sure that it's the length of the stream - which should be also the length of the char[] on the Java side.
I'm almost sure that I'm missing something simple here. Does anyone have an idea, what have I done wrong here?
Thank you in advance,
Attila
Open JAR file with any archiver program (7zip, WinRar)and check that demo.cashreg.json.JSONValidator class exists.
I used this functionality with %Library.GlobalBinaryStream/byte[] and it worked for me. Here's a sample.
Hi Eduard,
thank you for your answer. Actually: I could make it work with String parameters, but I'm still struggling with GlobalCharacterStream/char[]. So I'm pretty sure that the demo.cashreg.json.JSONValidator class is there. Also because it is the class, which I'm importing through the Java Gateway from the very same .jar file (successfully). Maybe I'm going to give it a try with GlobalBinrayStream/byte{] instead - however it should not make a difference.
Regards,
Attila