admin管理员组文章数量:1389779
I know it's not optimal, but I have to work with it, a page making calls to the applet.
My problem is, when I do so, I recieve a rather cryptic error message:
"uncaught exception: Error calling method on 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 basic call to the applet is from a javascript call:
document.getElementById('my_applet').passData("pass some data", someOtherData);
As you can see, the passData method is the exposed method I am trying to use. The applet itself works fine on the page, it's just when I try to call this, it doesn't do anything except throw that error.
If I ask the person working on the applet (it's not my portion) is it possible for them to add constructive error throwing or am I not even at the point of connecting to the applet yet?
I know it's not optimal, but I have to work with it, a page making calls to the applet.
My problem is, when I do so, I recieve a rather cryptic error message:
"uncaught exception: Error calling method on 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 basic call to the applet is from a javascript call:
document.getElementById('my_applet').passData("pass some data", someOtherData);
As you can see, the passData method is the exposed method I am trying to use. The applet itself works fine on the page, it's just when I try to call this, it doesn't do anything except throw that error.
If I ask the person working on the applet (it's not my portion) is it possible for them to add constructive error throwing or am I not even at the point of connecting to the applet yet?
Share Improve this question asked May 5, 2009 at 20:00 OrganiccatOrganiccat 5,65118 gold badges61 silver badges106 bronze badges2 Answers
Reset to default 4InvocationTargetException indicates that the underlying method in your applet threw an exception. The Javascript to Java "boundary" uses reflection, so exceptions thrown by the Java code are wrapped like this. (This makes it possible to distinguish them from exceptions thrown before you got into your Java code. For example, if you tried to call a non-existant method.)
You can get the original exception by catching the InvocationTargetException and then calling its getTargetException()
or getCause()
method (they both do exactly the same thing).
I'd suggest you look into what someOtherData is. If someOtherData isn't a correct type it could cause such an exception. It sounds like you're trying to pass a DOM object?
Take a look at this page in O'Reilly's JavaScript Guide to see available types.
本文标签: javaTrouble calling an applet method from pageStack Overflow
版权声明:本文标题:java - Trouble calling an applet method from page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744682541a2619498.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论