0
votes

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?

2
Can you download something from your http://sample:8080/crossdomain.xml?Constantiner
My site is hosted as "sample.com". And when i try "sample.com/crossdomain.xml, i am able to view the cross domain file i placed. <cross-domain-policy> <site-control permitted-cross-domain-policies="all"/> <allow-access-from to-ports="" domain=""/> </cross-domain-policy>sudar
@constantiner No. That doesnt open the crossdomain file. Should i be asking the host provider for the port details of their tomcat? TIA.sudar

2 Answers

1
votes

Take a look you have a different domains http://sample.com/ and http://sample:8080/.

0
votes

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.

<cross-domain-policy>
   <site-control permitted-cross-domain-policies="all"/>
   <allow-access-from domain="*" to-ports="*"/>
   <allow-http-request-headers-from domain="*" headers="*"/>
   <allow-http-request-headers-from domain="*"/>
</cross-domain-policy>