Malfunction of calling an applet method from a page

I know this is not optimal, but I need to work with it, the page makes the applet calls.

My problem is that when I do this, I get a rather cryptic error message:

"uncaught exception: method to raise an error in NPObject!

[plugin exception: java.lang.reflect.InvocationTargetException].

Can anyone decode this? Even multiple possibilities would be better than the junk I came up with. The main applet call is a javascript call:

document.getElementById('my_applet').passData("pass some data", someOtherData);

      

As you can see, the passData method is a public method that I am trying to use. The applet itself works fine on the page, and just when I try to call it it does nothing but an error.

If I ask the person working on the applet (this is not my portion), is it possible for them to add a constructive error, or am I not even going to connect to the applet?

+1


source to share


2 answers


InvocationTargetException indicates that the main method in your applet threw an exception. Javascript's "border" for Java uses reflection, so exceptions thrown by Java code are wrapped this way. (This allows you to distinguish them from the exceptions that you threw before getting into your Java code. For example, if you tried to call a method that does not exist.)



You can get the original exception by catching the InvocationTargetException and then calling its method, getTargetException()

or getCause()

(they both do the same).

+4


source


I would suggest that you look at what someOtherData is. If someOtherData is not the correct type, it can throw such an exception. It looks like you are trying to pass a DOM object?



Take a look at this page in the O'Reilly JavaScript Guide to see the types available.

0


source







All Articles