错误 #2048 安全沙箱违规 - 无法加载数据
当我尝试从 Flex 进行 Java 调用时,出现以下错误。
[RPC 故障 failureString="发送失败"
错误代码=“Client.Error.MessageSend”
failureDetail="Channel.Security.Error 错误
错误#2048:安全沙箱违规: “http://sample.com/sample.swf”不能 加载数据来自 http://sample:8080/messagebroker/amf。 网址: 'http://sample:8080/messagebroker/amf'"]
当我尝试在本地 tomcat 服务器中运行相同的内容时,这工作正常。但是当作为站点托管时,我收到此错误。我尝试放置跨域.xml 文件也在根目录中,但错误永远不会出现,如下所示
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" to-ports="*"/>
<cross-domain-policy/>
。
连接到 'http://sample:8080/messagebroker/amf' 已停止 - 不允许 http://sample.com/sample.swf。
有人在托管弹性网站时遇到过类似的问题吗?
I get the below error when i am trying to make a java call from flex.
[RPC Fault faultString="Send failed"
faultCode="Client.Error.MessageSend"
faultDetail="Channel.Security.Error error
Error #2048: Security sandbox violation:
'http://sample.com/sample.swf' cannot
load data from
http://sample:8080/messagebroker/amf.
url:
'http://sample:8080/messagebroker/amf'"]
When i tried running the same in my local tomcat server, this was working fine. But when hosted as a site, i am getting this error. I tried placing the crossdomain.xml file in the root directory too. But the error would never go. crossdomain file is like below.
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" to-ports="*"/>
<cross-domain-policy/>
The logs says this
Connection to
'http://sample:8080/messagebroker/amf'
halted - not permitted from
http://sample.com/sample.swf.
has anyone faced a similar problem in hosting a flex site?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看您有不同的域 http://sample.com/ 和 http://sample:8080/。
Take a look you have a different domains http://sample.com/ and http://sample:8080/.
游戏有点晚了,但还有其他一些项目需要检查。
您说过您可以运行 tomcat 的本地实例。我假设您以 localhost 的身份调用此服务,而不是通过 IP 地址(和/或计算机名称)。如果您正在运行 Flex 应用程序并且尚未更改运行配置,则您将从 localhost 运行。离开 locahost 域后,请确保进入运行配置(运行或调试按钮旁边的小向下箭头),并使用 IP 地址输入运行应用程序的本地路径。现在,您将运行应用程序的 IP 地址到服务的 IP 地址(或任何非本地主机)。这通常可以解决问题。
接下来,确保您的 crossdomain.xml 文件位于服务器的根目录。您应该能够浏览到 http://yourhostname/crossdomain.xml。不应涉及任何路径。 crossdomain.xml 应位于托管服务的根级别。
可能还需要将 Flex 工作区的本地实例设置为 Web 服务器(IIS、tomcat)下的虚拟目录。就我而言,我可以浏览到 127.0.0.1/workspace/someflexapp/bin-debug/projectname.html 并且 Flex 应用程序将运行。
已经经历过很多次了,按照上述步骤总是能解决问题。
您可以使用如下的 crossdomain.xml 文件来开放访问 Flex 从 Web/soap 服务请求的大多数内容。
A bit late to the game, but some other items to check.
You stated you can run off of the local instance of tomcat. I am going to assume you are invoking this service as localhost and not by IP address (and/or computer name). If you are running a flex app and you have not changed your run configurations, you are running from to localhost. Once you leave the locahost domain, ensure that you go into your run configurations (the little down arrow next to the run or debug button), and enter the local path you are running the application from using your IP address. Now you will be running IP address of application to IP address (or whatever not localhost) of service. This usually will resolve the problem.
Next, ensure your crossdomain.xml file is located at the ROOT of the server. you should be able to browse to http://yourhostname/crossdomain.xml. There should not be any pathing involved. crossdomain.xml should be at root level of hosting service.
It might also be necessary to set your local instance of workspace for Flex to a virtual directory under your web server (IIS, tomcat). In my case I can browse to 127.0.0.1/workspace/someflexapp/bin-debug/projectname.html and the flex app will run.
Been through this many times and following the above steps has always resolved the problems.
You can use a crossdomain.xml file such as below for open access to most everything that flex will request from a web/soap service.