使用反向代理('未知来源')在webbrowser上阻止签名的小程序

时间:2016-01-24 17:41:12

标签: java sandbox japplet signed-applet blocked

我在新网络服务器上部署签名小程序(来自可信CA的证书)时遇到问题。它在我的旧网络服务器上正常运行,但当我将其传输到新主机时,它被Java安全设置阻止。

我在我的html文件中将其部署为:

<div id="applet">
<script>
    var attributes = {codebase:'http://ab123.wwwdns.example.com/Applet/',
                      code: 'db.main.ExApplet',
                      archive: 'ExampleApplet.jar',
                      width: '1150', 
                      height: '700',
                      permissions: 'sandbox'};
    var parameters = {}; 
    var version = '1.6';
    deployJava.runApplet(attributes, parameters, version);
</script>
</div>

我的MANIFEST文件包含以下行:

Manifest-Version: 1.0
Application-Name: Example Name
Permissions: sandbox
Caller-Allowable-Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Application-Library-Allowable-Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Entry-Point: db.main.ExApplet

(之前我曾尝试过只指定* .example.com,但这也不起作用)

我想这个问题与applet现在可以通过两个不同的URL(ab123.wwwdns.example.com和other.example.com)访问这一事实有关?

以下是Java控制台的摘录(Firefox上的Java 8 Update 71 build 15插件):

java.lang.reflect.InvocationTargetException
...
Caused by: com.sun.deploy.security.BlockedException: Your security settings have blocked an untrusted application from running
    at com.sun.deploy.security.BlockedDialog.show(Unknown Source)
    at com.sun.deploy.security.SandboxSecurity.checkRunUntrusted(Unknown Source)
    at 
com.sun.deploy.security.SandboxSecurity.checkUnsignedSandboxSecurity(Unknown Source)
...

欢迎任何提示!

1 个答案:

答案 0 :(得分:0)

我终于解决了我的问题;我发现“未知来源”错误是由于我使用的外部库无法找到。这很奇怪,因为我使用完全相同的架构来访问外部库,就像我在旧服务器上所做的那样,但在新服务器上,这对某些(对我未知)的原因不起作用。

这里列出了我在研究期间使Applet工作的变化列表,现在它运行得非常好,希望这也可以帮助那些在部署applet时遇到问题的人:

  • 我从html文件中删除了codebase属性
  • 我在我的MANIFEST文件中使用了通配符* .example.com
  • 我将所有外部库移动到与ExampleApplet.jar相同的文件夹中,并且不再将它们添加到ExampleApplet.jar文件中
  • 之前我的Class-Path属性中有一个点(。),我也删除了

html文件

<div id="applet">
<script>
    var attributes = {code: 'db.main.ExApplet',
                      archive: 'ExampleApplet.jar',
                      width: '1150', 
                      height: '700',
                      permissions: 'sandbox'};
    var parameters = {}; 
    var version = '1.6';
    deployJava.runApplet(attributes, parameters, version);
</script>
</div>

MANIFEST文件

Manifest-Version: 1.0
Application-Name: Example Name
Permissions: sandbox
Caller-Allowable-Codebase: *.example.com 
Codebase: *.example.com 
Application-Library-Allowable-Codebase: *.example.com
Class-Path: external1.jar external2.jar
Entry-Point: db.main.ExApplet

(以前Class-Path看起来像这样,外部库位于lib /下,另外在ExampleApplet.jar中):

Class-Path: . lib/external1.jar lib/external2.jar