java - 签名的小程序被反向代理 ('Unknown Source' 阻止在网络浏览器上)

标签 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,但这也不起作用)

我猜这个问题与小程序现在可以通过两个不同的 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)
...

欢迎任何提示!

最佳答案

我终于解决了我的问题;我发现“未知来源”错误是由于找不到我使用的外部库造成的。这很奇怪,因为我使用与旧服务器上完全相同的体系结构来访问外部库,但在新服务器上,由于某些(对我来说未知)原因,这不起作用。

这里列出了我在研究过程中为使 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>

list 文件

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

(以前的类路径看起来像这样,外部库位于 lib/下,另外还位于 ExampleApplet.jar 中):

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

关于java - 签名的小程序被反向代理 ('Unknown Source' 阻止在网络浏览器上),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34979131/

相关文章:

java - Java 中是否有带符号的零整数?

java - 从 JApplet 关闭 JFrame

java - 无法在 html 上运行 Applet,ClassNotFoundException

java - 如何使用 xml 或 java 设置 gridview 单元格的背景颜色,但它不是自定义的

java - jmf 注册表无法添加项目 ()

java - 底部导航图标颜色更改

haskell - 哪些软件包被硬连线到 GHC 中?

Java Sandbox API - 拒绝访问已使用的类

c# - 即使不在授权集中,反射也不受限制

java - 用于小程序的 Intellij IDEA Designer