I have a GWT application that includes an embedded applet.
I would like to use JNSI to let GWT buttons push data to that applet, but at the moment I can't even get it to connect. Looking for some help - can't seem to find anything addressing how to make things talk.
In my entrypoint class I define:
native void doSomething() /*-{
$doc.applet_id.doSomething();
}-*/;
Which I hook via ClickHandler to a Button. Within the applet main class, there is a doSomething()
method, and in the page I launch the applet via:
<script>
var attributes = {codebase:'http://localhost:8888/',
code:'Applet.class', archive:'applet_test.jar', id:'applet_id',
width:100, height:40} ;
var parameters = {fontSize:16, jnlp_href:'launcher.jnlp'} ;
var version = '1.6' ;
deployJava.runApplet(attributes, parameters, version);
</script>
The stack trace is
com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:214)
at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:96)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:155)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:680)
Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError): $doc.applet_id.doSomething is not a function
Apparently my jnlp file also needed
<param name="MAYSCRIPT" value="true"/>
in the
<applet-desc>
portion. AddingMAYSCRIPT:true
to the attributes, however, did not seem to work.