JDK-6587166 : Java Plug-in crashes when launched from an IE that is embedded into a Java app.
  • Type: Enhancement
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6,6u7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,windows_xp
  • CPU: x86
  • Submitted: 2007-07-31
  • Updated: 2011-02-16
  • Resolved: 2008-10-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u10 b31Fixed 7Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When IE is embedded as an ActiveX control into a Java application the Java Plug-in will not load any Java applets. Instead it gives the following error message,

Java Plug-in Fatal Error

Cannot load class sun/plugin/JavaRunTime
The Bridge was installed at <C:\PRORA~1\Java\J2RE16~1.1_0>
but the class is not there.
Modify the registry key to reflect the new bridge location.
The key is HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in
or change your CLASSPATH to includethe new directory

If the same page is accessed through IE directly then it works fine.

There are various Java frameworks that are expierencing this problem.

Here are some example links that I found that discuss the problem.

Google Web Toolkit: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/e457dd98484be4bd

SWT: https://bugs.eclipse.org/bugs/show_bug.cgi?id=59506



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use Eclipse Browser or the Google Web Toolkit Browser to load a HTML page that contains an applet.

Alternatively run this example
http://www.codeproject.com/java/javacom.asp?df=100&forumid=651&exp=0&select=831063


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The applet should load and run and the page be displayed as normal.
ACTUAL -
The following error message is displayed and the process is completely locked and must be terminated via the Task Manager.

Java Plug-in Fatal Error

Cannot load class sun/plugin/JavaRunTime
The Bridge was installed at <C:\PRORA~1\Java\J2RE16~1.1_0>
but the class is not there.
Modify the registry key to reflect the new bridge location.
The key is HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in
or change your CLASSPATH to includethe new directory


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Java Plug-in Fatal Error

Cannot load class sun/plugin/JavaRunTime
The Bridge was installed at <C:\PRORA~1\Java\J2RE16~1.1_0>
but the class is not there.
Modify the registry key to reflect the new bridge location.
The key is HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in
or change your CLASSPATH to includethe new directory


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Checkout the source code here

http://www.codeproject.com/java/javacom.asp?df=100&forumid=651&exp=0&select=831063

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Disable the Java Plug-in.  You can do this by going in to Java in the control panel and under the Advance page uncheck APPLET tag support in Internet Explorer.

Comments
SUGGESTED FIX Combined webrev: http://sa.sfbay.sun.com/projects/deployment_data/6u11/6587166.1
21-08-2008

SUGGESTED FIX The following webrev contains fix for the old java plugin: http://web-east.east.sun.com/deployment/www/webrevs/ccheung/1.6.0/6587166/old_plugin/webrev/
02-08-2008

EVALUATION With JRE 6u10 and old java plugin, the crash is due to we're trying to dereferencing a null java object in the native code. There's some security exception thrown at the java level causing the native plugin code fails to find the IExplorerPluginContext java class and creates a global ref. to the plugin object. A potential fix in the old java plugin is to enclosed some java code within a doPrivileged block (see suggested fix for details). With the fix, there's a remaining AccessControlException triggered by the eclipse code from the testcase from CA. The call stack of the AccessControlException in the main thread is as follows: main: [1] java.security.AccessControlContext.checkPermission (null) [2] java.security.AccessController.checkPermission (null) [3] java.lang.SecurityManager.checkPermission (null) [4] java.lang.SecurityManager.checkPackageAccess (null) [5] sun.applet.AppletSecurity.checkPackageAccess (null) [6] sun.misc.Launcher$AppClassLoader.loadClass (null) [7] java.lang.ClassLoader.loadClass (null) [8] java.lang.ClassLoader.loadClassInternal (null) [9] org.eclipse.swt.internal.win32.OS.DispatchMessageW (native method) [10] org.eclipse.swt.internal.win32.OS.DispatchMessage (OS.java:1,473) [11] org.eclipse.swt.widgets.Display.readAndDispatch (Display.java:2,430) [12] SimpleSwtBrowser.main (SimpleSwtBrowser.java:38) Note that in order to load the old java plugin, one needs to set the following env. variable: set JAVA_PLUGIN_WEBCONTROL_ENABLE=1 Our java plugin also requires the -Xbootclasspath to contain the deploy.jar, plugin.jar, and javaws.jar. Since the jvm is used to start the app. with an embedded browser and the jvm arguments can't be modified once it has been started, the script for starting the app. needs to be modified to the following: set LIB_DIR=. set CLASSPATH=%LIB_DIR%\swt.jar;. set JAVA_PLUGIN_WEBCONTROL_ENABLE=1 java -cp %CLASSPATH% -Xbootclasspath/a:f:\progra~1\java\jre6\lib\deploy.jar;f:\progra~1\java\jre6\lib\plugin.jar;f:\progra~1\java\jre6\lib\javaws.jar -Djava.library.path=.;f:\progra~1\java\jre6\bin SimpleSwtBrowser Attaching the testcase from CA with the startup script modified to the attachment.
02-08-2008

EVALUATION The fix for the new Java Plugin is to use JNI_GetCreatedJavaVMs to check if there's a JVM available prior to creating a JVM.
31-07-2008

SUGGESTED FIX http://web-east.east.sun.com/deployment/www/webrevs/ccheung/1.6.0/6587166/webrev/ The above webrev contains fix for the new Java Plugin only.
31-07-2008

EVALUATION The problem is due to a jvm is already in use for starting the app. (testcase) and then when the embedded IE tries to load an applet, it tries to reuse the same jvm and fails. With the old plugin and loading an applet with the object tag, the failure is actually in CActivatorJNI::Initialize. The following fails with "ClassNotFound" error: SmartJClassRef clazz(env, PLUGINPKG "JavaRunTime"); The above is basically doing a m_env->FindClass(name); The m_env isn't NULL. I've also tried setting CLASSPATH variable to include F:\progra~1\java\jre6\lib\plugin.jar but still got the same error. With the old plugin and loading an applet with applet tag, it'll try to use the msvm. So it seems the TreatAs key is ignored in this scenario. The applet also fails to load with ClassNotFound error. The class is referring to the applet class in this case. ###@###.### said that in the context of the new Java Plug-In if we tried to make this work then it would be running the JVMManager recursively in the client attached JVM. We would need to modify JavaVM.c to handle the case where the JVM has already been created.
04-03-2008