Community
Participate
Working Groups
Build Identifier: I20090611-1540 Hello, We have SWT-based applet (uses SWT_AWT bridge) which we want to starts via webstart. Problems occurs when we try start second instance of that applet (in same browser). In last step of applet's UI initialization - on first call of display.readAndDispatch() is raised Invalid thread access exception. Line 2 on following code .. 1. while (!shell.isDisposed()) { 2. if (!display.readAndDispatch()) { 3. display.sleep(); 4. } 5. } 6. display.dispose(); Some facts: - Each applet instance has own shell and display and runs in own threads. - Same behavior in Mozilla Firefox and MS IE. - Exception isn't raised when applet is started WITHOUT Webstart/JNLP (but in classic approach). - Exception isn't raised when applet is started directly by javaws executable. I mean without browser java plugin (e.g. opening jnlp file from windows explorer). In that case have each applet own JVM. - Usage of pack200 doesn't have any impact to this issue. When more instances of applet is started by webstart from browser then some that applets are running in same JVM but in different "sandboxes" (different classloaders?) - so it looks that applets are separated but there still remains some sharing in SWT internals. If browser will start unique JVM for each webstart applet depends on browser. Firefox uses all time only one JVM, Internet Explorer starts more instances of JVM (e.g. 2 JVMs for 5 applets). Exception details: Java Plug-in 1.6.0_21 Using JRE version 1.6.0_21-b07 Java HotSpot(TM) Client VM .. .. Wed Oct 06 11:37:10 CEST 2010: TestApplet - Started Wed Oct 06 11:37:10 CEST 2010: TestApplet - Initialized. Start UI Loop. Exception in thread "UI" org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:3884) at org.eclipse.swt.SWT.error(SWT.java:3799) at org.eclipse.swt.SWT.error(SWT.java:3770) at org.eclipse.swt.widgets.Widget.error(Widget.java:463) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:355) at org.eclipse.swt.widgets.Shell.getShell(Shell.java:1080) at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:2568) at org.eclipse.swt.widgets.Widget.wmSetFocus(Widget.java:2282) at org.eclipse.swt.widgets.Control.WM_SETFOCUS(Control.java:4573) at org.eclipse.swt.widgets.Canvas.WM_SETFOCUS(Canvas.java:449) at org.eclipse.swt.widgets.Decorations.WM_SETFOCUS(Decorations.java:1728) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4014) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1578) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2010) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4589) at org.eclipse.swt.internal.win32.OS.SetFocus(Native Method) at org.eclipse.swt.widgets.Control.forceFocus(Control.java:978) at org.eclipse.swt.widgets.Control.setFocus(Control.java:2965) at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:928) at org.eclipse.swt.widgets.Shell.open(Shell.java:1220) at example.TestApplet.run(TestApplet.java:65) at java.lang.Thread.run(Unknown Source) I can provide war archive with mentioned testing applet and JNLP files. http://snadzitra.net/tmp/webstart/example-swt-webstart-applet.zip We were asking in Eclipse Community Forum, but without response. http://www.eclipse.org/forums/index.php?t=msg&th=197936&start=0&S=a8a75afdb90d8a39fc8160e67381ea9c Thanks in advance. Kind regards, -Jiri Sliva Reproducible: Always Steps to Reproduce: 1. Download and build (or use prepared war) following testing applet http://snadzitra.net/tmp/webstart/example-swt-webstart-applet.zip 2. Deploy it to some webserver (we tested it on apache-tomcat-6.0.26. 3. Start two instances of applet. 4. In Java Console you should see mentioned exception.
Created attachment 181382 [details] Testing applet sources. Two maven based project. - example-webstart-applet contains TestApplet class and produces example-webstart-applet-0.0.1.jar which will be included into war. - example-webstart-web is packaging war project. Build: go to folder example-webstart-applet $ mvn install go to folder example-webstart-web $ mvn install
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Applet is dead technology and no longer in recent JVMs nor browsers support it.