I am trying to print some information using an applet. The applet is located in the signed qds-client.jar file and has the following code:
public class PrintText extends Applet implements Printable {
private ClientAccount clientAccount;
public ClientAccount getClientAccount() {
return clientAccount;
}
public void setClientAccount (ClientAccount clientAccount) {
this.clientAccount = clientAccount;
}
public void setClientAccountFromJSON(String json) {
this.clientAccount = toClientAccountFromJSON(json);
System.out.println("------------------------------SetClient");
}
public int print(Graphics g, PageFormat format, int page) throws
...
}
public void printText() throws PrinterException {
...
}
private String getTextToPrint(ClientAccount clientAccount) throws PrinterException {
...
}
private ClientAccount toClientAccountFromJSON(String json) {
return JsonUtils.fromJson(ClientAccount.class, json);
}
public void startPrint () {
System.out.println("------------------------------------------Start");
}
}
The JNLP configuration looks like this:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.5+" codebase="http://localhost:10099/partials/" href="print.jnlp">
<information>
....
</information>
<resources>
<jar href="/partials/qds-client.jar"/>
<jar href="/partials/core-3.2.1.jar"/>
<jar href="/partials/gson-2.3.1.jar"/>
</resources>
<applet-desc name="printText" main-class="com.qdsrest.utils.printer.PrintText" width="500" height="200"></applet-desc>
<update check="background"/>
<security>
<all-permissions/>
</security>
Including the HTML tag for the applet:
<applet name="printApplet" jnlp_href="/partials/print.jnlp" width="10" height="10">
<param name="permissions" value="all-permissions"/>
</applet>
However, when I call a method from the applet in a JavaScript file like this:
document.printApplet.setClientAccountFromJSON({/not empty/});
I encounter the following error messages:
Error: Error calling method on NPObject!
In Mozilla and
basic: JNLP2ClassLoader.findClass: com.google.gson.internal.bind.CollectionTypeAdapterFactory: try again ..
basic: JNLP2ClassLoader.findClass: com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter: try again ..
basic: JNLP2ClassLoader.findClass: com.google.gson.internal.bind.MapTypeAdapterFactory: try again ..
basic: JNLP2ClassLoader.findClass: com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter: try again ..
basic: JNLP2ClassLoader.findClass: com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory: try again ..
In Java Console. It seems that the method isn't working properly. Why am I getting "try again .." messages? What do they mean? The method toClientAccountFromJSON uses the GSON library gson-2.3.1.jar, which successfully deserializes JSON objects into Java objects. What could be causing these issues? Please advise on the correct approach.