JavaFX不能正常使用Internet开发人员9和10(如果将文档模式设置为IE9)

时间:2021-12-18 16:59:27

I faced a problem in depolying JavaFX app in web and I got issue only with IE10 or IE9 and to be more precisely when the Document Mode is 9 , issue is that Browser cannot recognize the object 'app' which will be defined by JavaFx after being loaded . This object 'app' calls function 'tellme' with parameters. What I expect to see log on browser console: "____a OK maher", but what I get is an error message:

我在web上的depolying JavaFX应用程序中遇到了一个问题,我只在IE10或IE9中遇到了问题,更准确地说,当文档模式是9时,问题是浏览器无法识别被加载后JavaFX定义的对象“app”。这个对象“app”调用带有参数的“tellme”函数。我期望在浏览器控制台看到的是:“______ OK maher”,但我得到的却是一条错误消息:

SCRIPT438: Object doesn't support property or method 'tellme' 

Other info:

其他信息:

  • after launching Java there is prompt about publisher, permissions, see Image#1
  • 启动Java之后,有关于发布者、权限的提示,请参见图#1

JavaFX不能正常使用Internet开发人员9和10(如果将文档模式设置为IE9)

just accept and go on.

接受并继续。

  • Website requests access and control over JavaFx app ( there is JS <==> JavaFX ) and so there is a security warning about that and requests user to allow. see Image #2
  • 网站请求对JavaFx应用程序的访问和控制(有JS <= > JavaFx),因此有安全警告,并请求用户允许。见图片# 2

JavaFX不能正常使用Internet开发人员9和10(如果将文档模式设置为IE9)

Here I noted that in Document Mode IE9 I got this warning immediately after first one ..but on other browsers ( including DM IE8,DM IE7 ) its appearing after pressing clicl that means after calling JavaFx from JS via app.tellme

在这里,我注意到在文档模式IE9中,我在第一个警告之后马上收到了这个警告。但是在其他浏览器上(包括DM IE8,DM IE7),它的出现是在按下clicl之后出现的,这意味着在通过app.tellme调用JavaFx之后。

  • Again Issue only with IE, with other browser its OK ( Chrome, Opera, FF,.. etc ) also no issue with earlier versions of IE 7 and 8 ; briefly I have the problem only if IE document mode is set to IE9

    同样只在IE上发布,在其他浏览器上发布OK (Chrome, Opera, FF,…)等)也没有问题的早期版本的IE 7和8;简单地说,只有当IE文档模式设置为IE9时,我才会遇到这个问题

  • This has nothing with Signing .. I have a valid sign code cert ..and surely I set correct permissions on manifest ( codebase, permissions, ...etc) but really this has nothing with this issue .. only 2nd warning disappears but issue still persists.

    这与签名无关。我有一个有效的签名证书。当然,我对manifest(代码库、权限等)设置了正确的权限,但这与这个问题无关。只有第二次警告消失,但问题依然存在。

  • To simulate the issue:

    模拟的问题:

    1-Open main.html (codes below) with IE9 or IE10, press F12 to set Document Mode to IE 9.

    开放的主要。使用IE9或IE10的html(代码如下),按F12将文档模式设置为IE9。

    2-press start, and accept to run that app, then accept the following prompt to allow accessing JavaFx via JS.

    2按start,并接受运行该应用程序,然后接受以下提示,允许通过JS访问JavaFx。

    3-press clicl, on browser console you will see the error message .. what I expected to solve this issue to see output :"____a OK maher"

    点击3下,在浏览器控制台你会看到错误信息。我希望解决这个问题的目的是看输出:“a OK maher”

codes:

代码:

main.java ( JavaFX app) :updated

主要。java (JavaFX app):更新

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.im.oor;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import netscape.javascript.JSObject;

/**
 *
 * @author maher
 */
public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {



        Button btn = new Button();
        btn.setText("Say 'Hello World'");
        btn.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Hello World!");
            }
        });

        StackPane root = new StackPane();
        root.getChildren().add(btn);

        Scene scene = new Scene(root, 300, 250);
        publishServices();
        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }



    private static JSObject jsWin;

    private void publishServices() {

        try {


        JSObject jsWins = getHostServices().getWebContext();

        jsWins.setMember("app", new JavaAplicationCallBack());

        } catch (Exception e) {
            System.err.println("error with JSObject : "+e.getMessage());
        }
    }

    public class JavaAplicationCallBack {

        public String tellme(String uu) {
            return "OK " + uu;

        }
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
}

main.html (webpage):updated

主要。html(网页):更新

<!DOCTYPE html>
<html>
    <head>
        <!--<meta http-equiv="X-UA-Compatible" content="IE=8">-->
        <script src="web-files/dtjava.js"  type="text/javascript" ></script>
        <script src="jfx.js"  type="text/javascript" ></script>
        <script src="http://code.jquery.com/jquery-1.7.min.js">
        </script>
        <script>
            $(document).ready(function() {
                $("a.ll").live("click", function(event) {
                    callit('hi ');
                });
            });
        </script>
    </head>
    <body>
        <a href="#" onclick="launchit();" >start</a>
        <a class='ll' href="#"  >clicl</a>
        <!-- Applet will be inserted here -->
        <div id='javafx-app-placeholder'></div>
    </body>
</html>

jfx.js ( javascript used on main.html ):updated

jfx。主要使用的javascript。html):更新

function javafxEmbed() {
    dtjava.embed(
            {
                url : 'TestIdleCallJavaFx.jnlp',
                //url: 'Testjfx.jnlp',
                placeholder: 'javafx-app-placeholder',
                width: 300,
                height: 100,
                jnlp_content: 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iVGVzdElkbGVDYWxsSmF2YUZ4LmpubHAiPg0KICA8aW5mb3JtYXRpb24+DQogICAgPHRpdGxlPlRlc3RJZGxlQ2FsbEphdmFGeDwvdGl0bGU+DQogICAgPHZlbmRvcj5NYWhlcjwvdmVuZG9yPg0KICAgIDxkZXNjcmlwdGlvbj5TYW1wbGUgSmF2YUZYIDIuMCBhcHBsaWNhdGlvbi48L2Rlc2NyaXB0aW9uPg0KICAgIDxvZmZsaW5lLWFsbG93ZWQvPg0KICA8L2luZm9ybWF0aW9uPg0KICA8cmVzb3VyY2VzPg0KICAgIDxqZng6amF2YWZ4L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ZXN0amZ4IiAgbmFtZT0iVGVzdGpmeCIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
            },
            {
                javafx: '2.2+'

            },
            {}
        );

        }






function launchit(){
dtjava.addOnloadCallback(javafxEmbed);
}


function callit(aa){
alert(aa);
console.log("____ "+aa);
var ttt=app.tellme("maher ");
console.log("____a "+ttt);

}
  • Note that if you build code it may generate different jnlp_content that what I have. so just update it.
  • 注意,如果您构建代码,它可能会生成不同的jnlp_content。所以就更新它。

* I zipped all files into http://ulozto.cz/xV2vrQTd/javafx-dm-ie9-zip

*我将所有文件压缩到http://ulozto.cz/xV2vrQTd/javafx-dm-ie9-zip中

* Source code is here : http://247workers.com/JFX_src/TestIdleCallJavaFx.zip

*源代码在这里:http://247workers.com/jfx_src/vesdlecalljavafx.zip

Here some steps how to successfully get it work:

这里有一些如何成功地让它工作的步骤:

1- I am using latest version of JDK/JRE 7u45

1-我使用的是最新版本的JDK/JRE 7u45。

2- using Menu File ==> import ==> import from zip

2-使用菜单文件=>导入=>从zip导入

3- Clean And Build

3 -清洁和构建

4-copy all content under dist in project into directory work and overwrite any thing if you already have something there.

4将项目中dist项下的所有内容复制到目录工作中,如果已经有内容,则覆盖任何内容。

5- it will be better to show Java Console during deploying via Control Panel ==> Java ==> Advanced ==> under Java console, choose show console.

5-在Java控制台下,通过Control Panel ==> Java ==> Advanced =>显示Java控制台更好,选择show Console。

  • About using
  • 关于使用

< meta http-equiv="X-UA-Compatible" content="IE=8">

< meta http-equiv =“X-UA-Compatible”内容=“IE = 8”>

to enforce using older rendering engine but this wont be accepted on our enterprise project Im working on.

为了强制使用旧的渲染引擎,但这不会被我们的企业项目所接受。

I hope I will get assistance here ... sorry for long post but I wanted to be very specific and provide all necessary info .

我希望能在这里得到帮助……很抱歉我发了很长一段时间的邮件,但我想说得非常具体,并提供所有必要的信息。

1 个解决方案

#1


1  

This is due to a bug in the Java plugin. As far as I can tell there is no workaround and the bug is still present in Java 8.

这是由于Java插件中的一个错误。就我所知,目前还没有解决方案,Java 8中仍然存在bug。

For some reason in IE9 and IE10 (edge won't load Java at all for me) the toString() method is called on the object you want to expose to the browser. This is evident by using the developer tools to inspect app.

由于某些原因,在IE9和IE10中(edge根本不会为我加载Java), toString()方法被调用,对象是您希望公开给浏览器的对象。通过使用开发人员工具检查应用程序,这一点是显而易见的。

I've turned on debug for the browser and plugin (JPI_PLUGIN2_DEBUG=1 and JPI_PLUGIN2_VERBOSE=1) and I'm seeing some differences between IE8 and IE9 mode, but nothing showing me exactly where in the plugin code the object is being transformed to a String.

我已经打开了浏览器和插件的调试(JPI_PLUGIN2_DEBUG=1和JPI_PLUGIN2_VERBOSE=1),我看到了IE8和IE9模式之间的一些区别,但是没有任何东西能确切地告诉我,在插件代码中,对象正在被转换成一个字符串。

The next course of action is to try and override the plugin with a custom build to see where the problem is actually occurring. However, that may be more trouble than it's worth since it's already been determined the bug is in the plugin and there's no known workaround. In other words, even if a fix was found you probably couldn't deploy a patched version of Java to your enterprise customers. It looks like the only solution is to use a different browser or IE in documentMode 8 or less.

下一步的操作是尝试用自定义构建来覆盖插件,以查看问题实际发生的位置。然而,这可能比它的价值更麻烦,因为它已经确定漏洞在插件中,并且没有已知的解决办法。换句话说,即使找到了解决方案,您也可能无法将修补过的Java版本部署到企业客户端。看起来唯一的解决方案是使用不同的浏览器或IE在文档模式8或更少。

I've included some logs for completeness. Note: I changed the names of the jnlp and classes to mirror my environment, but the result is the same.

为了完整性,我包含了一些日志。注意:我更改了jnlp和类的名称以反映我的环境,但是结果是一样的。

IE9 Console Log

IE9控制台日志

NativeLibLoader: resolving loaded C:\Program Files (x86)\Java\jre8\bin\jp2iexp.d
ll
   (Succeeded)
IExplorerPlugin.IExplorerPlugin(0x3aaefe8)
IExplorerPlugin.IExplorerPlugin(1.8.0)
NativeLibLoader: C:\PROGRA~2\Java\jre8\lib\bin\jp2native.dll doesn't exist
NativeLibLoader: trying to load C:\PROGRA~2\Java\jre8\bin\jp2native.dll
  (Succeeded)
IExplorerPlugin.addParameters(cAxControl = 0x3aaefe8)
IExplorerPlugin.CreateControlWindow(cAxControl = 0x3aaefe8, hWndParent = 0x3071e
, hWndControlWindow = 0x1d0348)
IExplorerPlugin.SetObjectRects(cAxControl = 0x3aaefe8, left = 8, right = 308, to
p = 26, bottom = 126, appletID = null, activated = false)
{IExplorerPlugin.InPlaceActivate(cAxControl = 0x3aaefe8) entered
}IExplorerPlugin.InPlaceActivate(cAxControl = 0x3aaefe8) exited
IExplorerPlugin.SetObjectRects(cAxControl = 0x3aaefe8, left = 8, right = 308, to
p = 26, bottom = 126, appletID = null, activated = true)
  Attempting to start applet
1 JavaFX runtime found.
  1) JavaFX 8.0.0 found at C:\PROGRA~2\Java\jre8\
JVMLauncher.start: launcher params:
        <-Djnlp.fx=8.0.0>
        <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGRA~2\Java
\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        <--->
        <-->
        <sun.plugin2.main.client.PluginMain>
        <read_pipe_name=jpi2_pid2136_pipe2,write_pipe_name=jpi2_pid2136_pipe3>
JVMLauncher.start(): now - user.startApplet(): 14520 us
JVMLauncher.processArg[0]: C:\Program Files (x86)\Java\jre8\bin\jp2launcher.exe
JVMLauncher.processArg[1]: -D__jvm_launched=22791732422
JVMLauncher.processArg[2]: -D__applet_launched=22791717902
JVMLauncher.processArg[3]: -Djnlp.fx=8.0.0
JVMLauncher.processArg[4]: sun.plugin2.main.client.PluginMain
JVMLauncher.processArg[5]: read_pipe_name=jpi2_pid2136_pipe2,write_pipe_name=jpi
2_pid2136_pipe3
JVMLauncher.processArgs total len: 234, custArgsMaxLen: 8044
JVMLauncher.afterStart(): starting JVM process watcher
JVMInstance.start: JVMID original params array:
        [0][0]: <-Djnlp.fx=8.0.0>
        [0][1]: <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGR
A~2\Java\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        [0][2]: <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        [4][0]: <null>
JVMInstance for 1.8.0.ea sending start applet message
  isRelaunch: false
  appletLaunchTime: 22791717902
  Parameters:
    jnlp_href=Main.jnlp
    launchjnlp=
    code=dummy.class
    java_status_events=true
    type=application/x-java-applet
    separate_jvm=true
    javafx_version=2.2+
    javafx_applet_id=dtjava-app-1
    codebase=http://172.16.218.1/
    width=300
    name=dtjava-app-1
    id=dtjava-app-1
    scriptable=true
    height=100
JVMInstance.registerApplet for applet ID 1, plugin sun.plugin2.main.server.IExpl
orerPlugin@44dec8
  Received applet ID [AppletID 1]
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
  LiveConnectSupport: retained [BrowserSideObject 0x3ecd730] for applet 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
JVMInstance (1.8.0.ea) processing JavaScriptEvalMessage
JVMInstance (1.8.0.ea) processing JavaScriptMemberOpMessage
LiveConnectSupport.sendRemoteJavaObjectOp: CALL_METHOD "toString"
AbstractPlugin.doJavaObjectOp starting to wait for result ID 1
JVMInstance (1.8.0.ea) processing JavaReplyMessage
JVMInstance received JavaReplyMessage with result ID 1
AbstractPlugin.doJavaObjectOp ending wait for result ID 1
LiveConnectSupport: result [ResultID 1] = JavaApplicationCallBack Test
JVMInstance for 1.8.0.ea sending release remote object message for ID 1
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
  LiveConnectSupport: schedule release [BrowserSideObject 0x3ecd730] for applet
1

IE8 Console Log

IE8控制台日志

NativeLibLoader: resolving loaded C:\Program Files (x86)\Java\jre8\bin\jp2iexp.d
ll
   (Succeeded)
IExplorerPlugin.IExplorerPlugin(0x4c1efe8)
IExplorerPlugin.IExplorerPlugin(1.8.0)
NativeLibLoader: C:\PROGRA~2\Java\jre8\lib\bin\jp2native.dll doesn't exist
NativeLibLoader: trying to load C:\PROGRA~2\Java\jre8\bin\jp2native.dll
  (Succeeded)
IExplorerPlugin.addParameters(cAxControl = 0x4c1efe8)
IExplorerPlugin.CreateControlWindow(cAxControl = 0x4c1efe8, hWndParent = 0xd04b4
, hWndControlWindow = 0x1a030a)
IExplorerPlugin.SetObjectRects(cAxControl = 0x4c1efe8, left = -9990, right = -96
90, top = 28, bottom = 128, appletID = null, activated = false)
{IExplorerPlugin.InPlaceActivate(cAxControl = 0x4c1efe8) entered
}IExplorerPlugin.InPlaceActivate(cAxControl = 0x4c1efe8) exited
IExplorerPlugin.SetObjectRects(cAxControl = 0x4c1efe8, left = -9990, right = -96
90, top = 28, bottom = 128, appletID = null, activated = true)
  Attempting to start applet
1 JavaFX runtime found.
  1) JavaFX 8.0.0 found at C:\PROGRA~2\Java\jre8\
JVMLauncher.start: launcher params:
        <-Djnlp.fx=8.0.0>
        <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGRA~2\Java
\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        <--->
        <-->
        <sun.plugin2.main.client.PluginMain>
        <read_pipe_name=jpi2_pid2740_pipe2,write_pipe_name=jpi2_pid2740_pipe3>
JVMLauncher.start(): now - user.startApplet(): 12763 us
JVMLauncher.processArg[0]: C:\Program Files (x86)\Java\jre8\bin\jp2launcher.exe
JVMLauncher.processArg[1]: -D__jvm_launched=25562522742
JVMLauncher.processArg[2]: -D__applet_launched=25562509979
JVMLauncher.processArg[3]: -Djnlp.fx=8.0.0
JVMLauncher.processArg[4]: sun.plugin2.main.client.PluginMain
JVMLauncher.processArg[5]: read_pipe_name=jpi2_pid2740_pipe2,write_pipe_name=jpi
2_pid2740_pipe3
JVMLauncher.processArgs total len: 234, custArgsMaxLen: 8044
JVMLauncher.afterStart(): starting JVM process watcher
JVMInstance.start: JVMID original params array:
        [0][0]: <-Djnlp.fx=8.0.0>
        [0][1]: <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGR
A~2\Java\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        [0][2]: <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        [4][0]: <null>
JVMInstance for 1.8.0.ea sending start applet message
  isRelaunch: false
  appletLaunchTime: 25562509979
  Parameters:
    jnlp_href=Main.jnlp
    launchjnlp=
    code=dummy.class
    java_status_events=true
    type=application/x-java-applet
    separate_jvm=true
    javafx_version=2.2+
    javafx_applet_id=dtjava-app-1
    codebase=http://172.16.218.1/
    width=300
    name=dtjava-app-1
    id=dtjava-app-1
    scriptable=true
    height=100
JVMInstance.registerApplet for applet ID 1, plugin sun.plugin2.main.server.IExpl
orerPlugin@66906f
  Received applet ID [AppletID 1]
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
  LiveConnectSupport: retained [BrowserSideObject 0x397ca24] for applet 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
JVMInstance (1.8.0.ea) processing JavaScriptEvalMessage
JVMInstance (1.8.0.ea) processing JavaScriptMemberOpMessage
IExplorerPlugin.SetObjectRects(cAxControl = 0x4c1efe8, left = 10, right = 310, t
op = 28, bottom = 128, appletID = [AppletID 1], activated = true)
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
  LiveConnectSupport: schedule release [BrowserSideObject 0x397ca24] for applet
1

Stacktrace of toString() being called in IE9

在IE9中调用的toString()的Stacktrace

at Main$JavaAplicationCallBack.toString(Main.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport.doObjectOp(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.doMemberOp(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.setMember(Unknown Source)
at Main.publishServices(Main.java:55)
at Main.start(Main.java:38)
at com.sun.javafx.applet.FXApplet2$2.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(Unknown Source)
at com.sun.glass.ui.win.WinApplication$4$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

#1


1  

This is due to a bug in the Java plugin. As far as I can tell there is no workaround and the bug is still present in Java 8.

这是由于Java插件中的一个错误。就我所知,目前还没有解决方案,Java 8中仍然存在bug。

For some reason in IE9 and IE10 (edge won't load Java at all for me) the toString() method is called on the object you want to expose to the browser. This is evident by using the developer tools to inspect app.

由于某些原因,在IE9和IE10中(edge根本不会为我加载Java), toString()方法被调用,对象是您希望公开给浏览器的对象。通过使用开发人员工具检查应用程序,这一点是显而易见的。

I've turned on debug for the browser and plugin (JPI_PLUGIN2_DEBUG=1 and JPI_PLUGIN2_VERBOSE=1) and I'm seeing some differences between IE8 and IE9 mode, but nothing showing me exactly where in the plugin code the object is being transformed to a String.

我已经打开了浏览器和插件的调试(JPI_PLUGIN2_DEBUG=1和JPI_PLUGIN2_VERBOSE=1),我看到了IE8和IE9模式之间的一些区别,但是没有任何东西能确切地告诉我,在插件代码中,对象正在被转换成一个字符串。

The next course of action is to try and override the plugin with a custom build to see where the problem is actually occurring. However, that may be more trouble than it's worth since it's already been determined the bug is in the plugin and there's no known workaround. In other words, even if a fix was found you probably couldn't deploy a patched version of Java to your enterprise customers. It looks like the only solution is to use a different browser or IE in documentMode 8 or less.

下一步的操作是尝试用自定义构建来覆盖插件,以查看问题实际发生的位置。然而,这可能比它的价值更麻烦,因为它已经确定漏洞在插件中,并且没有已知的解决办法。换句话说,即使找到了解决方案,您也可能无法将修补过的Java版本部署到企业客户端。看起来唯一的解决方案是使用不同的浏览器或IE在文档模式8或更少。

I've included some logs for completeness. Note: I changed the names of the jnlp and classes to mirror my environment, but the result is the same.

为了完整性,我包含了一些日志。注意:我更改了jnlp和类的名称以反映我的环境,但是结果是一样的。

IE9 Console Log

IE9控制台日志

NativeLibLoader: resolving loaded C:\Program Files (x86)\Java\jre8\bin\jp2iexp.d
ll
   (Succeeded)
IExplorerPlugin.IExplorerPlugin(0x3aaefe8)
IExplorerPlugin.IExplorerPlugin(1.8.0)
NativeLibLoader: C:\PROGRA~2\Java\jre8\lib\bin\jp2native.dll doesn't exist
NativeLibLoader: trying to load C:\PROGRA~2\Java\jre8\bin\jp2native.dll
  (Succeeded)
IExplorerPlugin.addParameters(cAxControl = 0x3aaefe8)
IExplorerPlugin.CreateControlWindow(cAxControl = 0x3aaefe8, hWndParent = 0x3071e
, hWndControlWindow = 0x1d0348)
IExplorerPlugin.SetObjectRects(cAxControl = 0x3aaefe8, left = 8, right = 308, to
p = 26, bottom = 126, appletID = null, activated = false)
{IExplorerPlugin.InPlaceActivate(cAxControl = 0x3aaefe8) entered
}IExplorerPlugin.InPlaceActivate(cAxControl = 0x3aaefe8) exited
IExplorerPlugin.SetObjectRects(cAxControl = 0x3aaefe8, left = 8, right = 308, to
p = 26, bottom = 126, appletID = null, activated = true)
  Attempting to start applet
1 JavaFX runtime found.
  1) JavaFX 8.0.0 found at C:\PROGRA~2\Java\jre8\
JVMLauncher.start: launcher params:
        <-Djnlp.fx=8.0.0>
        <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGRA~2\Java
\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        <--->
        <-->
        <sun.plugin2.main.client.PluginMain>
        <read_pipe_name=jpi2_pid2136_pipe2,write_pipe_name=jpi2_pid2136_pipe3>
JVMLauncher.start(): now - user.startApplet(): 14520 us
JVMLauncher.processArg[0]: C:\Program Files (x86)\Java\jre8\bin\jp2launcher.exe
JVMLauncher.processArg[1]: -D__jvm_launched=22791732422
JVMLauncher.processArg[2]: -D__applet_launched=22791717902
JVMLauncher.processArg[3]: -Djnlp.fx=8.0.0
JVMLauncher.processArg[4]: sun.plugin2.main.client.PluginMain
JVMLauncher.processArg[5]: read_pipe_name=jpi2_pid2136_pipe2,write_pipe_name=jpi
2_pid2136_pipe3
JVMLauncher.processArgs total len: 234, custArgsMaxLen: 8044
JVMLauncher.afterStart(): starting JVM process watcher
JVMInstance.start: JVMID original params array:
        [0][0]: <-Djnlp.fx=8.0.0>
        [0][1]: <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGR
A~2\Java\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        [0][2]: <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        [4][0]: <null>
JVMInstance for 1.8.0.ea sending start applet message
  isRelaunch: false
  appletLaunchTime: 22791717902
  Parameters:
    jnlp_href=Main.jnlp
    launchjnlp=
    code=dummy.class
    java_status_events=true
    type=application/x-java-applet
    separate_jvm=true
    javafx_version=2.2+
    javafx_applet_id=dtjava-app-1
    codebase=http://172.16.218.1/
    width=300
    name=dtjava-app-1
    id=dtjava-app-1
    scriptable=true
    height=100
JVMInstance.registerApplet for applet ID 1, plugin sun.plugin2.main.server.IExpl
orerPlugin@44dec8
  Received applet ID [AppletID 1]
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
  LiveConnectSupport: retained [BrowserSideObject 0x3ecd730] for applet 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
JVMInstance (1.8.0.ea) processing JavaScriptEvalMessage
JVMInstance (1.8.0.ea) processing JavaScriptMemberOpMessage
LiveConnectSupport.sendRemoteJavaObjectOp: CALL_METHOD "toString"
AbstractPlugin.doJavaObjectOp starting to wait for result ID 1
JVMInstance (1.8.0.ea) processing JavaReplyMessage
JVMInstance received JavaReplyMessage with result ID 1
AbstractPlugin.doJavaObjectOp ending wait for result ID 1
LiveConnectSupport: result [ResultID 1] = JavaApplicationCallBack Test
JVMInstance for 1.8.0.ea sending release remote object message for ID 1
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
  LiveConnectSupport: schedule release [BrowserSideObject 0x3ecd730] for applet
1

IE8 Console Log

IE8控制台日志

NativeLibLoader: resolving loaded C:\Program Files (x86)\Java\jre8\bin\jp2iexp.d
ll
   (Succeeded)
IExplorerPlugin.IExplorerPlugin(0x4c1efe8)
IExplorerPlugin.IExplorerPlugin(1.8.0)
NativeLibLoader: C:\PROGRA~2\Java\jre8\lib\bin\jp2native.dll doesn't exist
NativeLibLoader: trying to load C:\PROGRA~2\Java\jre8\bin\jp2native.dll
  (Succeeded)
IExplorerPlugin.addParameters(cAxControl = 0x4c1efe8)
IExplorerPlugin.CreateControlWindow(cAxControl = 0x4c1efe8, hWndParent = 0xd04b4
, hWndControlWindow = 0x1a030a)
IExplorerPlugin.SetObjectRects(cAxControl = 0x4c1efe8, left = -9990, right = -96
90, top = 28, bottom = 128, appletID = null, activated = false)
{IExplorerPlugin.InPlaceActivate(cAxControl = 0x4c1efe8) entered
}IExplorerPlugin.InPlaceActivate(cAxControl = 0x4c1efe8) exited
IExplorerPlugin.SetObjectRects(cAxControl = 0x4c1efe8, left = -9990, right = -96
90, top = 28, bottom = 128, appletID = null, activated = true)
  Attempting to start applet
1 JavaFX runtime found.
  1) JavaFX 8.0.0 found at C:\PROGRA~2\Java\jre8\
JVMLauncher.start: launcher params:
        <-Djnlp.fx=8.0.0>
        <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGRA~2\Java
\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        <--->
        <-->
        <sun.plugin2.main.client.PluginMain>
        <read_pipe_name=jpi2_pid2740_pipe2,write_pipe_name=jpi2_pid2740_pipe3>
JVMLauncher.start(): now - user.startApplet(): 12763 us
JVMLauncher.processArg[0]: C:\Program Files (x86)\Java\jre8\bin\jp2launcher.exe
JVMLauncher.processArg[1]: -D__jvm_launched=25562522742
JVMLauncher.processArg[2]: -D__applet_launched=25562509979
JVMLauncher.processArg[3]: -Djnlp.fx=8.0.0
JVMLauncher.processArg[4]: sun.plugin2.main.client.PluginMain
JVMLauncher.processArg[5]: read_pipe_name=jpi2_pid2740_pipe2,write_pipe_name=jpi
2_pid2740_pipe3
JVMLauncher.processArgs total len: 234, custArgsMaxLen: 8044
JVMLauncher.afterStart(): starting JVM process watcher
JVMInstance.start: JVMID original params array:
        [0][0]: <-Djnlp.fx=8.0.0>
        [0][1]: <-Xbootclasspath/a:C:\PROGRA~2\Java\jre8\lib\deploy.jar;C:\PROGR
A~2\Java\jre8\lib\javaws.jar;C:\PROGRA~2\Java\jre8\lib\plugin.jar>
        [0][2]: <-Djava.class.path=C:\PROGRA~2\Java\jre8\classes>
        [4][0]: <null>
JVMInstance for 1.8.0.ea sending start applet message
  isRelaunch: false
  appletLaunchTime: 25562509979
  Parameters:
    jnlp_href=Main.jnlp
    launchjnlp=
    code=dummy.class
    java_status_events=true
    type=application/x-java-applet
    separate_jvm=true
    javafx_version=2.2+
    javafx_applet_id=dtjava-app-1
    codebase=http://172.16.218.1/
    width=300
    name=dtjava-app-1
    id=dtjava-app-1
    scriptable=true
    height=100
JVMInstance.registerApplet for applet ID 1, plugin sun.plugin2.main.server.IExpl
orerPlugin@66906f
  Received applet ID [AppletID 1]
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing GetProxyMessage
Delegate to plugin instance on browser main thread.
Browser main thread handle GetProxyMessage.
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing CookieOpMessage
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
  LiveConnectSupport: retained [BrowserSideObject 0x397ca24] for applet 1
JVMInstance (1.8.0.ea) processing StartAppletAckMessage with:
        appletID: 1
JVMInstance (1.8.0.ea) processing JavaScriptGetWindowMessage
JVMInstance (1.8.0.ea) processing JavaScriptEvalMessage
JVMInstance (1.8.0.ea) processing JavaScriptMemberOpMessage
IExplorerPlugin.SetObjectRects(cAxControl = 0x4c1efe8, left = 10, right = 310, t
op = 28, bottom = 128, appletID = [AppletID 1], activated = true)
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
JVMInstance (1.8.0.ea) processing JavaScriptReleaseObjectMessage
  LiveConnectSupport: schedule release [BrowserSideObject 0x397ca24] for applet
1

Stacktrace of toString() being called in IE9

在IE9中调用的toString()的Stacktrace

at Main$JavaAplicationCallBack.toString(Main.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport.doObjectOp(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.doMemberOp(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.setMember(Unknown Source)
at Main.publishServices(Main.java:55)
at Main.start(Main.java:38)
at com.sun.javafx.applet.FXApplet2$2.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(Unknown Source)
at com.sun.glass.ui.win.WinApplication$4$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)