0

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?

inazaruk
  • 74,247
  • 24
  • 188
  • 156
sudar
  • 1
  • 1
  • 1
  • 1
  • Can you download something from your `http://sample:8080/crossdomain.xml`? – Constantiner May 30 '11 at 21:05
  • 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. – sudar May 30 '11 at 21:23
  • @constantiner No. That doesnt open the crossdomain file. Should i be asking the host provider for the port details of their tomcat? TIA. – sudar May 30 '11 at 21:29

2 Answers2

1

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

Constantiner
  • 14,231
  • 4
  • 27
  • 34
  • i tried changing the endpoint for the remoteobject to be http://sample.com/messagebroker/amf . But it throws the below error when launched [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://sample.com/messagebroker/amf'"]' – sudar May 30 '11 at 21:18
  • What port is your Tomcat running on in production? – Constantiner May 30 '11 at 21:21
  • I am not sure of it. I am a newbie to web hosting. I just hosted in a paid hosting site. I tried with the port '80' and '8080' guessing it to be the default ones. Both gave the security sandbox violation error which i never got rid of. When tested using my local tomcat server, it was working perfectly fine. – sudar May 30 '11 at 21:27
  • I recommend you not to use hardcoded endpoint but use standard template form `http://{server.name}:{server.port}/{context.root}/messagebroker/amf`. In case of hosting it is very possible you should omit context root so just try to use `http://{server.name}:{server.port}/messagebroker/amf` – Constantiner May 30 '11 at 21:31
0

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>