使用Java 1.6.0.22,我无法打开到本地主机的套接字,该小程序未签名,并且正在从网络服务器 http: //localhost/myapplet
如果我从我的计算机 ip 192.168.1.x 加载它并打开一个到该 ip 的套接字,它就可以工作
用一个简单的演示,只打开一个套接字,它就可以工作,但是只要我的小程序使用JavaScript 到 Java 调用套接字不起作用。
如果我添加 crossdomain.xml 文件,套接字将再次工作。
如果我只允许 127.0.0.1 它不起作用
1.6.0.17 它工作正常
这与问题类似
与未签名 Java applet 的原始服务器的套接字连接
但就我而言,我从网络服务器而不是本地文件系统加载小程序。
With Java 1.6.0.22 i'm not able to open a socket to localhost, the applet is unsigned and is being loaded from the webserver http://localhost/myapplet
If i load it from my computer ip 192.168.1.x and open a socket to that ip it works
With a simple demo that only open a socket it works, but as soon as my applet use JavaScript to Java calls the socket not work.
If I add a crossdomain.xml file the socket works again.
If I allow only 127.0.0.1 it doesn't work
With 1.6.0.17 it works fine
That is similar to question
Socket connection to originating server of an unsigned Java applet
But in my case i loading applet from a webserver not from local file system.
发布评论
评论(4)
通过这个有类似问题的用户,我发现了相关的oracle bug
http://www.oracle.com/technetwork/java/javase/6u22releasenotes-176121.html
Via this user having a similar problem i found the relevant oracle bug
access denied (java.net.SocketPermission 127.0.0.1:8080 connect,resolve)
http://www.oracle.com/technetwork/java/javase/6u22releasenotes-176121.html
未签名的小程序只能打开与加载它们的主机的连接。
Unsigned applets can only open connections to the host they were loaded from.
Oracle 知道这个 Java 问题严重限制了 Applet 的使用:Java 运行时环境中的安全漏洞可能允许从本地文件系统加载的代码访问 LocalHost。翻译:如果您希望运行与 Tomcat 这样的服务器通信的 Java Applet,则无法使用最新的 Java 版本来实现。
他们的解决方案是:此问题没有解决方法。
他们知道这个问题多久了? 2008 年 12 月 3 日,错误 ID 6704154
您可以在 https://identity.sun.com/amserver/UI/Login?org=self_registered_users&goto=http://sunsolve.sun.com/ show.do?target=home
Oracle knows of this Java problem that severely restricts use of Applets: A Security Vulnerability in the Java Runtime Environment may Allow Code Loaded From the Local Filesystem to Access LocalHost. The translation: if you wish to run Java Applets that talk to a server like Tomcat, you can’t do it with recent Java releases
And their solution is: There is no workaround for this issue.
And how long have they known of this problem? 03-Dec-2008, Bug Id 6704154
You can validate the above information at, https://identity.sun.com/amserver/UI/Login?org=self_registered_users&goto=http://sunsolve.sun.com/show.do?target=home
虽然文档说小程序只能打开与加载它的主机的连接,但在 Tomcat 5 中,该说法并不正确。我有一个小程序,它总是生成“AccessControlException:访问被拒绝(java.net.SocketPermission 66.167.210:80 连接,解析”),即使我已授予此 URL 的套接字权限。我仍在尝试解决此问题并愿意接受任何建议。
While the documentation says an applet can only open a connection to the host it was loaded from, with Tomcat 5, that statement is not true. I have an applet that invariably generates a, "AccessControlException:access denied (java.net.SocketPermission 66.167.210:80 connect, resolve" even though I've given socket permission to this URL. I'm still trying to solve this issue and am open to any recommendations.