我的任务是将我们古老的 Java 小程序从小程序标签更新为对象标签,因为小程序标签已经被弃用了一段时间。该小程序必须可以追溯到早期的 Java 1.6 版本,在可追溯到 IE6 的浏览器上。我制作了以下对象标签来处理这个问题,根据用户是否使用 IE 来切换它们。<% %> 中的语句评估良好,只需填写 jar 文件等。
<% If userIsIE > 0 Then %>
<object type="application/x-java-applet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="0" width="0">
<param name="code" value="<% =MainClass %>" />
<param name="archive" value="<% =Archives %>" />
<param name="persistState" value="false" />
</object>
<% Else %>
<object classid="java:<% =MainClass %>" type="application/x-java-applet" archive="<% =Archives %>" height="0" width="0">
<param name="code" value="<% =MainClass %>" />
<param name="archive" value="<% =Archives %>" />
<param name="persistState" value="false" />
</object>
<% End If %>
它适用于我尝试过的所有浏览器,以及我尝试过的所有 Java 版本,除了我的同事发现的一个特定情况:使用 Java 1.6.0_20 运行 IE9(可能还有其他一些旧版本,未经证实)导致页面崩溃,将其留在我的桌面上:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d413f5f, pid=2444, tid=4660
#
# JRE version: 6.0_20-b02
# Java VM: Java HotSpot(TM) Client VM (16.3-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [jp2iexp.dll+0x3f5f]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x00b09000): JavaThread "main" [_thread_in_native, id=4660, stack(0x027c0000,0x029c0000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
Registers:
EAX=0x00000000, EBX=0x3420a218, ECX=0x0041f5e0, EDX=0x029bd5bc
ESP=0x029bd598, EBP=0x029bd5a8, ESI=0x00000000, EDI=0x00b09000
EIP=0x6d413f5f, EFLAGS=0x00010206
Top of Stack: (sp=0x029bd598)
0x029bd598: 029bd5bc 029bd5a4 3420a218 00000000
0x029bd5a8: 029bd5e8 05e89f47 00b09110 029bd5f0
0x029bd5b8: 00442258 00000000 00b096ac fffffffe
0x029bd5c8: 029bd5c8 3420a218 029bd5fc 34213020
0x029bd5d8: 00000000 3420a218 00000000 029bd5f8
0x029bd5e8: 029bd624 05e82f07 34212a30 05e88286
0x029bd5f8: 00442258 00000000 32298a58 029bd604
0x029bd608: 3420a187 029bd62c 34213020 00000000
Instructions: (pc=0x6d413f5f)
0x6d413f4f: 33 f6 85 c0 7c 3a 8b 45 fc 8d 55 14 52 89 75 14
0x6d413f5f: 8b 08 50 ff 91 a0 00 00 00 85 c0 7c 1a 8b 75 14
Stack: [0x027c0000,0x029c0000], sp=0x029bd598, free space=7f5029bd0cck
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [jp2iexp.dll+0x3f5f]
j sun.plugin2.main.server.IExplorerPlugin.getDocumentBase0(J)Ljava/lang/String;+0
j sun.plugin2.main.server.IExplorerPlugin.getDocumentBase()Ljava/lang/String;+31
j sun.plugin2.main.server.JVMInstance.startApplet(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZIZZ)Z+14
j sun.plugin2.main.server.JVMManager.startAppletImpl(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZLjava/lang/String;ZIZ)Lsun/plugin2/main/server/AppletID;+240
j sun.plugin2.main.server.JVMManager.startApplet(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZLjava/lang/String;)Lsun/plugin2/main/server/AppletID;+16
j sun.plugin2.main.server.JVMManager.startApplet(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZ)Lsun/plugin2/main/server/AppletID;+19
j sun.plugin2.main.server.IExplorerPlugin.maybeStartApplet()V+192
j sun.plugin2.main.server.IExplorerPlugin.access$200(Lsun/plugin2/main/server/IExplorerPlugin;)V+1
j sun.plugin2.main.server.IExplorerPlugin$BackgroundStarter$1.run()V+7
v ~StubRoutines::call_stub
V [jvm.dll+0xf049c]
V [jvm.dll+0x17fcf1]
V [jvm.dll+0xf051d]
V [jvm.dll+0xf9e0f]
V [jvm.dll+0xfcc07]
C [jp2iexp.dll+0x17a5]
C [jp2iexp.dll+0x853b]
C [jp2iexp.dll+0x7a32]
C [USER32.dll+0x1fd72]
C [USER32.dll+0x1fe4a]
C [USER32.dll+0x2018d]
C [USER32.dll+0x2022b]
C [IEFRAME.dll+0xf1c24]
C [IEFRAME.dll+0x111afe]
C [iertutil.dll+0x1416c0]
C [IEFRAME.dll+0xffe3b]
C [kernel32.dll+0x4d0e9]
C [ntdll.dll+0x41603]
C [ntdll.dll+0x415d6]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.plugin2.main.server.IExplorerPlugin.getDocumentBase0(J)Ljava/lang/String;+0
j sun.plugin2.main.server.IExplorerPlugin.getDocumentBase()Ljava/lang/String;+31
j sun.plugin2.main.server.JVMInstance.startApplet(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZIZZ)Z+14
j sun.plugin2.main.server.JVMManager.startAppletImpl(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZLjava/lang/String;ZIZ)Lsun/plugin2/main/server/AppletID;+240
j sun.plugin2.main.server.JVMManager.startApplet(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZLjava/lang/String;)Lsun/plugin2/main/server/AppletID;+16
j sun.plugin2.main.server.JVMManager.startApplet(Ljava/util/Map;Lsun/plugin2/main/server/Plugin;JJZ)Lsun/plugin2/main/server/AppletID;+19
j sun.plugin2.main.server.IExplorerPlugin.maybeStartApplet()V+192
j sun.plugin2.main.server.IExplorerPlugin.access$200(Lsun/plugin2/main/server/IExplorerPlugin;)V+1
j sun.plugin2.main.server.IExplorerPlugin$BackgroundStarter$1.run()V+7
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x056d0400 JavaThread "JRE 1.6.0.20 Heartbeat Thread" [_thread_blocked, id=5860, stack(0x085d0000,0x086d0000)]
0x056dc000 JavaThread "JRE 1.6.0.20 Worker Thread" [_thread_blocked, id=3760, stack(0x09580000,0x09680000)]
0x056db800 JavaThread "JRE 1.6.0.20 Output Reader Thread" [_thread_in_native, id=3828, stack(0x09390000,0x09490000)]
0x056db400 JavaThread "JRE 1.6.0.20 Output Reader Thread" [_thread_in_native, id=5472, stack(0x09120000,0x09220000)]
0x056d9c00 JavaThread "Thread-0" [_thread_in_native, id=3572, stack(0x08d10000,0x08e10000)]
0x056d8400 JavaThread "Java Plug-In Pipe Worker Thread (Server-Side)" daemon [_thread_in_native, id=3944, stack(0x08f10000,0x09010000)]
0x05668800 JavaThread "traceMsgQueueThread" daemon [_thread_blocked, id=3620, stack(0x08ab0000,0x08bb0000)]
0x05640000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=6092, stack(0x08940000,0x08a40000)]
0x0563b800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2788, stack(0x086d0000,0x087d0000)]
0x05639400 JavaThread "Attach Listener" daemon [_thread_blocked, id=3728, stack(0x08060000,0x08160000)]
0x05637400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2912, stack(0x084c0000,0x085c0000)]
0x0562f800 JavaThread "Finalizer" daemon [_thread_blocked, id=4596, stack(0x082d0000,0x083d0000)]
0x0562e400 JavaThread "Reference Handler" daemon [_thread_blocked, id=4676, stack(0x08160000,0x08260000)]
=>0x00b09000 JavaThread "main" [_thread_in_native, id=4660, stack(0x027c0000,0x029c0000)]
Other Threads:
0x0562c000 VMThread [stack: 0x07f50000,0x08050000] [id=4684]
0x05647000 WatcherThread [stack: 0x08840000,0x08940000] [id=760]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 4928K, used 1321K [0x32200000, 0x32750000, 0x32ca0000)
eden space 4416K, 29% used [0x32200000, 0x3234a460, 0x32650000)
from space 512K, 0% used [0x32650000, 0x32650000, 0x326d0000)
to space 512K, 0% used [0x326d0000, 0x326d0000, 0x32750000)
tenured generation total 10944K, used 0K [0x32ca0000, 0x33750000, 0x34200000)
the space 10944K, 0% used [0x32ca0000, 0x32ca0000, 0x32ca0200, 0x33750000)
compacting perm gen total 12288K, used 705K [0x34200000, 0x34e00000, 0x38200000)
the space 12288K, 5% used [0x34200000, 0x342b05f8, 0x342b0600, 0x34e00000)
ro space 10240K, 51% used [0x38200000, 0x3872ae00, 0x3872ae00, 0x38c00000)
rw space 12288K, 54% used [0x38c00000, 0x392972d8, 0x39297400, 0x39800000)
Dynamic libraries:
0x01100000 - 0x011b8000 C:\Program Files\Internet Explorer\iexplore.exe
0x77910000 - 0x77a38000 C:\Windows\system32\ntdll.dll
0x77650000 - 0x7772c000 C:\Windows\system32\kernel32.dll
0x77730000 - 0x777f6000 C:\Windows\system32\ADVAPI32.dll
0x77aa0000 - 0x77b63000 C:\Windows\system32\RPCRT4.dll
0x77870000 - 0x7790d000 C:\Windows\system32\USER32.dll
0x77800000 - 0x7784b000 C:\Windows\system32\GDI32.dll
0x760f0000 - 0x7619a000 C:\Windows\system32\msvcrt.dll
0x77490000 - 0x774e9000 C:\Windows\system32\SHLWAPI.dll
0x761d0000 - 0x76ce1000 C:\Windows\system32\SHELL32.dll
0x76f40000 - 0x77085000 C:\Windows\system32\ole32.dll
0x75fd0000 - 0x760e1000 C:\Windows\system32\urlmon.dll
0x774f0000 - 0x7757d000 C:\Windows\system32\OLEAUT32.dll
0x77120000 - 0x772d8000 C:\Windows\system32\iertutil.dll
0x77370000 - 0x7748b000 C:\Windows\system32\WININET.dll
0x77a40000 - 0x77a43000 C:\Windows\system32\Normaliz.dll
0x77850000 - 0x7786e000 C:\Windows\system32\IMM32.DLL
0x77580000 - 0x77648000 C:\Windows\system32\MSCTF.dll
0x77110000 - 0x77119000 C:\Windows\system32\LPK.DLL
0x77090000 - 0x7710d000 C:\Windows\system32\USP10.dll
0x74a90000 - 0x74c2e000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18305_none_5cb72f2a088b0ed3\comctl32.dll
0x6d630000 - 0x6df76000 C:\Windows\system32\IEFRAME.dll
0x75fc0000 - 0x75fc7000 C:\Windows\system32\PSAPI.DLL
0x74350000 - 0x7438e000 C:\Windows\system32\OLEACC.dll
0x76d20000 - 0x76d93000 C:\Windows\system32\comdlg32.dll
0x71ac0000 - 0x71af1000 C:\Program Files\Internet Explorer\IEShims.dll
0x75e60000 - 0x75e74000 C:\Windows\system32\Secur32.dll
0x76cf0000 - 0x76d1d000 C:\Windows\system32\WS2_32.dll
0x76da0000 - 0x76da6000 C:\Windows\system32\NSI.dll
0x75830000 - 0x75849000 C:\Windows\system32\iphlpapi.dll
0x757f0000 - 0x75825000 C:\Windows\system32\dhcpcsvc.DLL
0x75a70000 - 0x75a9c000 C:\Windows\system32\DNSAPI.dll
0x757e0000 - 0x757e7000 C:\Windows\system32\WINNSI.DLL
0x757b0000 - 0x757d2000 C:\Windows\system32\dhcpcsvc6.DLL
0x6c5a0000 - 0x6d15b000 C:\Windows\system32\MSHTML.dll
0x752c0000 - 0x752c8000 C:\Windows\system32\VERSION.dll
0x75370000 - 0x753ab000 C:\Windows\system32\rsaenh.dll
0x772e0000 - 0x77364000 C:\Windows\system32\CLBCatQ.DLL
0x714a0000 - 0x714d2000 C:\Program Files\Internet Explorer\ieproxy.dll
0x71e60000 - 0x71eb3000 C:\Windows\system32\ACTXPRXY.DLL
0x75e00000 - 0x75e2c000 C:\Windows\system32\apphelp.dll
0x71aa0000 - 0x71ab1000 C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\AcroIEHelperShim.dll
0x714e0000 - 0x7157b000 C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4016_none_d0893820442e7fe4\MSVCR80.dll
0x715b0000 - 0x71637000 C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4016_none_d0893820442e7fe4\MSVCP80.dll
0x73490000 - 0x734a0000 C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\AcroIEHelper.dll
0x6d440000 - 0x6d44c000 C:\Program Files\Java\jre6\bin\jp2ssv.dll
0x7c340000 - 0x7c396000 C:\Program Files\Java\jre6\bin\MSVCR71.dll
0x75d40000 - 0x75d9f000 C:\Windows\system32\SXS.DLL
0x73c20000 - 0x73c50000 C:\Windows\system32\MLANG.dll
0x74470000 - 0x744ba000 C:\Windows\system32\RASAPI32.dll
0x746e0000 - 0x746f4000 C:\Windows\system32\rasman.dll
0x75cc0000 - 0x75d36000 C:\Windows\system32\NETAPI32.dll
0x74430000 - 0x74461000 C:\Windows\system32\TAPI32.dll
0x74620000 - 0x7462c000 C:\Windows\system32\rtutils.dll
0x74390000 - 0x743c2000 C:\Windows\system32\WINMM.dll
0x75e80000 - 0x75e9e000 C:\Windows\system32\USERENV.dll
0x758d0000 - 0x759c2000 C:\Windows\system32\CRYPT32.dll
0x75a30000 - 0x75a42000 C:\Windows\system32\MSASN1.dll
0x73020000 - 0x73026000 C:\Windows\system32\sensapi.dll
0x75700000 - 0x75707000 C:\Windows\system32\credssp.dll
0x753b0000 - 0x753f7000 C:\Windows\system32\schannel.dll
0x70c60000 - 0x70ccc000 C:\Windows\system32\ieapfltr.dll
0x6f570000 - 0x6f72b000 C:\Windows\System32\jscript9.dll
0x73000000 - 0x7300b000 C:\Windows\system32\msimtf.dll
0x74930000 - 0x749eb000 C:\Windows\system32\PROPSYS.dll
0x71970000 - 0x71a64000 C:\Windows\system32\windowscodecs.dll
0x76db0000 - 0x76f3a000 C:\Windows\system32\setupapi.dll
0x70bb0000 - 0x70c5b000 C:\Windows\system32\d2d1.dll
0x70020000 - 0x70128000 C:\Windows\system32\DWrite.dll
0x70b30000 - 0x70bb0000 C:\Windows\system32\dxgi.dll
0x737f0000 - 0x737fc000 C:\Windows\system32\dwmapi.dll
0x74690000 - 0x746bd000 C:\Windows\system32\WINTRUST.dll
0x761a0000 - 0x761c9000 C:\Windows\system32\imagehlp.dll
0x716b0000 - 0x716dc000 C:\Windows\system32\d3d10_1.dll
0x713f0000 - 0x7142a000 C:\Windows\system32\d3d10_1core.dll
0x6fef0000 - 0x7001c000 C:\Windows\system32\D3D10Warp.dll
0x6f460000 - 0x6f562000 C:\Windows\system32\d3d10.dll
0x70db0000 - 0x70de3000 C:\Windows\system32\d3d10core.dll
0x752f0000 - 0x75311000 C:\Windows\system32\NTMARTA.DLL
0x77a50000 - 0x77a99000 C:\Windows\system32\WLDAP32.dll
0x75a50000 - 0x75a61000 C:\Windows\system32\SAMLIB.dll
0x755f0000 - 0x7562b000 C:\Windows\system32\mswsock.dll
0x751f0000 - 0x751f5000 C:\Windows\System32\wshtcpip.dll
0x752b0000 - 0x752bf000 C:\Windows\system32\NLAapi.dll
0x73440000 - 0x73446000 C:\Windows\system32\rasadhlp.dll
0x70af0000 - 0x70b23000 C:\Windows\system32\windowscodecsext.dll
0x72940000 - 0x72a9b000 C:\Windows\System32\msxml6.dll
0x6d410000 - 0x6d42e000 C:\Program Files\Java\jre6\bin\jp2iexp.dll
0x737d0000 - 0x737d7000 C:\Windows\system32\wsock32.dll
0x732d0000 - 0x732df000 C:\Windows\system32\napinsp.dll
0x732c0000 - 0x732c8000 C:\Windows\System32\winrnr.dll
0x744c0000 - 0x74545000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6002.18305_none_88f3a38569c2c436\comctl32.dll
0x05be0000 - 0x05e77000 C:\PROGRA~1\Java\jre6\bin\client\jvm.dll
0x01fe0000 - 0x01fec000 C:\PROGRA~1\Java\jre6\bin\verify.dll
0x6d330000 - 0x6d34f000 C:\PROGRA~1\Java\jre6\bin\java.dll
0x6d290000 - 0x6d298000 C:\PROGRA~1\Java\jre6\bin\hpi.dll
0x02420000 - 0x0242f000 C:\PROGRA~1\Java\jre6\bin\zip.dll
0x6d430000 - 0x6d436000 C:\Program Files\Java\jre6\bin\jp2native.dll
0x6d1d0000 - 0x6d1e3000 C:\Program Files\Java\jre6\bin\deploy.dll
0x6d610000 - 0x6d623000 C:\Program Files\Java\jre6\bin\net.dll
0x75650000 - 0x75655000 C:\Windows\System32\wship6.dll
0x025b0000 - 0x025b9000 C:\Program Files\Java\jre6\bin\nio.dll
0x02760000 - 0x027a4000 C:\Program Files\Java\jre6\bin\regutils.dll
0x08bb0000 - 0x08cfa000 C:\Program Files\Java\jre6\bin\awt.dll
0x72d30000 - 0x72d72000 C:\Windows\system32\WINSPOOL.DRV
VM Arguments:
jvm_args: -Xbootclasspath/a:C:\PROGRA~1\Java\jre6\lib\deploy.jar;C:\PROGRA~1\Java\jre6\lib\javaws.jar;C:\PROGRA~1\Java\jre6\lib\plugin.jar -Xmx32m -Djava.awt.headless=true -Dkernel.background.download=false -Dkernel.download.dialog=false -XX:MaxDirectMemorySize=64m
java_command: <unknown>
Launcher Type: generic
Environment Variables:
JAVA_HOME=C:\j2sdk1.4.2_04\
PATH=C:\Program Files\Internet Explorer;;C:\Windows\System32;C:\j2sdk1.4.2_04\bin;C:\Windows\System32\WindowsPowerShell\v1.0\
USERNAME=mlebson
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 30 Stepping 5, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows Server 2008 Build 6002 Service Pack 2
CPU:total 4 (8 cores per cpu, 2 threads per core) family 6 model 30 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht
Memory: 4k page, physical 4183352k(3147268k free), swap 8613472k(7704200k free)
vm_info: Java HotSpot(TM) Client VM (16.3-b01) for windows-x86 JRE (1.6.0_20-b02), built on Apr 12 2010 13:52:23 by "java_re" with MS VC++ 7.1 (VS2003)
time: Wed Dec 12 14:31:46 2012
elapsed time: 0 seconds
它看起来像 JVM 本身中的空指针异常。如果我摆脱了我拥有的“IE 特定”版本并在 Else 之后只使用第二个版本,它仍然会发生。我也尝试将高度和宽度更改为非零值,认为它可能会对这些值做一些奇怪的事情,但没有。如果我回到使用小程序标签,同时保持所有参数和设置相同,则不会发生这种情况。现在,如果我纯粹为自己做这件事,我会接受这是旧 JVM 中的一个错误,并要求人们升级到最新版本的 Java(运行良好),但我们的许多客户都是企业用户,非常“ “粘性”的 IT 部门需要很长时间才能推出更新,或者甚至不知道 Java 是什么的用户,更不用说知道如何更新它了。我是否会放弃并继续使用小程序标签,直到浏览器完全停止支持它们?有没有我没有尝试过的技巧来完成这项工作?
编辑:我做了更多测试,看起来 java 测试页面本身(http://www.java.com/en/download/testjava.jsp)也会导致同样的崩溃。也许我只需要使用小程序标签,直到我们所有的客户都更新了,如果它太糟糕以至于官方的 java 测试小程序甚至无法加载。