嵌入签名的小程序

发布于 2024-11-29 04:00:54 字数 745 浏览 0 评论 0原文

我有一个 Java 小程序,它将与本地服务器建立 TCP 连接并获取一些数据。我对小程序进行了自签名,当我在 netbeans 中运行小程序时,它工作正常,但是当我尝试将小程序嵌入到网页中时,我收到此错误:

java.lang.SecurityException: trusted loader attempted to load sandboxed resource from file:/C:/Users/...
    at com.sun.deploy.security.CPCallbackHandler$ParentCallback.check(Unknown Source)
    at com.sun.deploy.security.CPCallbackHandler$ParentCallback.access$1500(Unknown Source)
    at com.sun.deploy.security.CPCallbackHandler$ChildElement.checkResource(Unknown Source)
...

HTML

<APPLET codebase="classes" archive="lib1.jar, lib2.jar" code="test/Test.class" width=350 height=200></APPLET>

我猜测使用 code 属性会导致问题,因为仅对 jar 文件进行了签名,这些类文件是由 netbeans 生成的。

I have a Java applet which will establish a TCP connection with a local server and get some data. I self signed the applets, and when I run the applet in netbeans it works fine, but when I try to embed the applet into a webpage, I get this error:

java.lang.SecurityException: trusted loader attempted to load sandboxed resource from file:/C:/Users/...
    at com.sun.deploy.security.CPCallbackHandler$ParentCallback.check(Unknown Source)
    at com.sun.deploy.security.CPCallbackHandler$ParentCallback.access$1500(Unknown Source)
    at com.sun.deploy.security.CPCallbackHandler$ChildElement.checkResource(Unknown Source)
...

HTML

<APPLET codebase="classes" archive="lib1.jar, lib2.jar" code="test/Test.class" width=350 height=200></APPLET>

I'm guessing that using the code attribute is causing the issue because only the jar files were signed, and those class files were generated by netbeans.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恍梦境° 2024-12-06 04:00:54

我不太确定,因为我看不到完整的图片及其所有细节,但正如我所看到的,这里提到了一个非常不寻常的例外:

可信加载程序尝试从 file:/C:/Users/... 加载沙盒资源

我可能建议您尝试加载,正如我所注意到的,两个罐子...

archive="lib1.jar, lib2.jar

so

A) 也许其中一个(或两个)jar 未签名,但确实包含“安全限制代码”,因此它仍然由小程序的沙箱控制
我想你应该对所有可能包含 IO 调用的 jar 进行签名

,或者

B) 你的 jar 位置 file:/C:/Users/... 对于小程序来说是很不寻常的由于文件协议...通常,所有jar都应该直接从applet本机主机下载,而不是本地文件系统...所以我建议您部署它并重试。 ...让我们看看有什么变化

C) 只需仔细观察所有小程序对象调用语法,尤其是 JS 或 HTML 中的

语法
无论如何,要告诉更多信息,最好至少看到整个 stackTrace 及其“原因”

祝你好运

I am not pretty sure because I cannot see the whole picture with all its details but as I can see here is mentioned a quite unusual exception as

trusted loader attempted to load sandboxed resource from file:/C:/Users/...

I may suggest that you are trying to load, as I can notice, two jars as...

archive="lib1.jar, lib2.jar

so

A) perhaps one (or both) of the jars is NOT SIGNED but do contain "security restricted code" so it is still controlled by applets' sandbox
I guess you should sign all jars which may contain IO invokation

OR

B) Your jar location as file:/C:/Users/... is quite unusual as for applet because of file protocol... As a rule, all jars should be downloaded right from the applet native host but not a local file system... So I suggest you to deploy it and try again. ...Lets see what changes

OR

C) Just watch carefully all applet objects calls syntax especially in JS or HTML

P.S.
Anyway, to tell more it would be better to see, at least, the whole stackTrace with its "cause by"

Good luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文