[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 11427
  • Last Modified:

Channel.Security.Error error Error #2048: Security sandbox violation: when launching Flex application

I've currently got a web server (tomcat) configured for localhost(8080) that serves up some information through Java.

I've got a flex project build in Flex that is configured to connect to this project via BlazeDS.  When I launch the application from Flex Builder, everything is fine.  I'm able to see all my data, retrieve data remotely through RPC, etc.

However, when I build the flex app, and run it from my desktop, I get the following error:
[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Security.Error error Error #2048: Security sandbox violation: file:///C:/Users/User/Desktop/export test/LoginMenu.swf cannot load data from http://localhost:8080/Framework/messagebroker/amf. url: 'http://localhost:8080/Framework/messagebroker/amf'"]
      at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()
      at mx.rpc::Responder/fault()
      at mx.rpc::AsyncRequest/fault()

I've tried adding a crossdomain.xml file to my tomcat root directory and restarting the server, but I am not seeing any difference, nor is this error going away.  What do I need to do to resolve this error?
0
csciguy81
Asked:
csciguy81
  • 8
  • 6
3 Solutions
 
Fuzzy_Logic_Commented:
To start with:

What do you get if you go to:

http://localhost:8080/crossdomain.xml 

You should get the file. If you do there is most likely an error in the file.
0
 
csciguy81Author Commented:
HTTP Status 404 - /crossdomain.xml

The contents of the crossdomain.xml is this.

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

I've put this file in the root of the tomcat directory that I launch tomcat out of: \tomcat\webapps\ROOT
0
 
Fuzzy_Logic_Commented:
try http://localhost:80/crossdomain.xml

if successful you need to change the port tomcat listens on from 80 to 8080.
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
csciguy81Author Commented:
I ended up changing my tomcat instance.  The file resides in the tomcat installation directory, along with bin, conf, etc etc.  Is that the correct location, or should it reside in the tomcat/webapps folder instead?
0
 
Fuzzy_Logic_Commented:
it should be here: \tomcat\webapps\ROOT

This is the default directory for hosting from tomcat.
0
 
csciguy81Author Commented:
Last question, upping the points here respectively.

Everything I've done up to this point has been with tomcat on my machine, running blazeDS, and Flex running off of local host.  I've moved the tomcat instance to another PC now and I can view on my network.

The other PC has an IP on my network of say 11.11.11.11, so to ensure tomcat is running, I can hit 11.11.11.11:8080/whatever and see that that is working fine from any other PC.  However, if I export my flex project to another PC on my network, it's giving me an error of "cannot load data from http://localhost:8080/whatever/messagebroker/swf".  How do I change that address to 11.11.11.11:8080 in my flex configuration?
0
 
Fuzzy_Logic_Commented:
To change that:

In Flex IDE Click 'Project' then 'Properties' then 'Flex Server' you should have a Root Folder box and a Root URL box. Place the real path to the Root Folder in the Root Folder text box and 11.11.11.11:8080 in Root URL text box.

Regards FL.

ps. The real path to the root folder will be specific to each machine, so when you export the project to another computer you will have to make sure that the real path is correct for that machine.
0
 
csciguy81Author Commented:
I'm a little confused here.

I have tomcat deployed on a local lan, with an IP of say 11.11.11.11.  This server also holds a mysql database.  No problems here.

From another machine (11.11.11.12) on the lan, I can access the tomcat drop of 11.11.11.11:8080/Framework.  I can see the directory listing fine.

When I export this project from Flex, and change the Flex Server to 11.11.11.11, will that cause any remote object calls, etc to point to that IP?

In order to "run" the flex app, I'm opening the exported folder on 11.11.11.12.  Is it better to take this flex export and to host it on 11.11.11.11 and then have 11.11.11.12 access it via http?  I'm a little confused on best practice here.
0
 
csciguy81Author Commented:
Another question.

I changed the Flex Server to 11.11.11.11 and rebuilt my app in flex builder.  When the app builds, it gets thrown into a folder in my tomcat deployment.  I then go over to java, export that as a war, and take that war to put it on 11.11.11.11.  From 11.11.11.12, I can access 11.11.11.11/whateverurl/testpage.html which brings up the Flex app.  However, whenever I try to make any remote calls, it's still trying to contact localhost instead of 11.11.11.11.  What am I doing wrong here?
0
 
csciguy81Author Commented:
Okay, I think I've almost got this.

Changed the server in flex builder to that of where the web server is located.

Modified the URL of the services-config.xml and pointed it to 11.11.11.11.  

Rebuilt, redeployed, hit the http and everything works fine.

Last question, and I'm done here.

Is it possible to define the URL/path in such a way that the destination URL is not known?  For example.  Say I want to deploy this to a server without knowing that servers direct IP address.  How would I indicate that?  Using localhost works fine, when you're on that server, but crashes hard when you're trying to access the app from the client.
0
 
Fuzzy_Logic_Commented:
To be honest I'm a bit lost as to where you are.

Once deployed it needs the address for your RemoteObject calls. It doesn't need to know where it is.

What does your services-config.xml file look like, specifically the endpoint-uri, that shoud be somtehing like http://www.mysite.com/myServices/, I can only guess you still have http://localhost/MyServices/

0
 
csciguy81Author Commented:
My services-config.xml has various entries in it, that point to the endpoint-uri that is where the flex app is hosted.  Using the above example IP's, it points to 11.11.11.11.

<channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://localhost:8080/Framework/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-seconds>4</polling-interval-seconds>
            </properties>
        </channel-definition>

and so on...
0
 
csciguy81Author Commented:
ugh.  change that localhost in what i just pasted there to 11.11.11.11.  
0
 
Fuzzy_Logic_Commented:
Hi csciguy.

To be honest I think you should close this question as unsolved and ask a fresh question to get some fresh interest.

Maybe I'm missing something.

To sum up:

You have a server that has the cross-domain policy in its root as below, On this server is Java/BlazeDS and your flexApp. Its address is 11.11.11.11

Everything works fine if you access your app from 11.11.11.11 However when you access it from 11.11.11.12 the remoteObject calls aren't working. The services-config file is pointing to the correct address as below.

To me this is a cross-domain policy issue. But if it comes up when you type http://11.11.11.11/crossdomain.xml then I'm at a loss.

Regards FL

ps. I also think this post may have confused things a little: This was specifically for building/debugging your flex app, its irrelevant when it comes to deployment.

[QUOTE]***************************

To change that:

In Flex IDE Click 'Project' then 'Properties' then 'Flex Server' you should have a Root Folder box and a Root URL box. Place the real path to the Root Folder in the Root Folder text box and 11.11.11.11:8080 in Root URL text box.

Regards FL.

ps. The real path to the root folder will be specific to each machine, so when you export the project to another computer you will have to make sure that the real path is correct for that machine.

[END QUOTE]************************

CROSS-DOMAIN
 
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
 
EXTRACT FROM SERVICES-CONFIG
 
<channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://11.11.11.11/Framework/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-seconds>4</polling-interval-seconds>
            </properties>
</channel-definition>

Open in new window

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now