Solved

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

Posted on 2009-05-07
14
11,179 Views
Last Modified: 2013-11-11
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
Comment
Question by:csciguy81
  • 8
  • 6
14 Comments
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24330119
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
 

Author Comment

by:csciguy81
ID: 24330156
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
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24330708
try http://localhost:80/crossdomain.xml

if successful you need to change the port tomcat listens on from 80 to 8080.
0
 

Author Comment

by:csciguy81
ID: 24369257
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
 
LVL 5

Assisted Solution

by:Fuzzy_Logic_
Fuzzy_Logic_ earned 500 total points
ID: 24373047
it should be here: \tomcat\webapps\ROOT

This is the default directory for hosting from tomcat.
0
 

Author Comment

by:csciguy81
ID: 24376744
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
 
LVL 5

Accepted Solution

by:
Fuzzy_Logic_ earned 500 total points
ID: 24381162
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:csciguy81
ID: 24486712
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
 

Author Comment

by:csciguy81
ID: 24486945
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
 

Author Comment

by:csciguy81
ID: 24487700
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
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24488698
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
 

Author Comment

by:csciguy81
ID: 24521396
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
 

Author Comment

by:csciguy81
ID: 24521401
ugh.  change that localhost in what i just pasted there to 11.11.11.11.  
0
 
LVL 5

Assisted Solution

by:Fuzzy_Logic_
Fuzzy_Logic_ earned 500 total points
ID: 24526322
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now