1 Reply Latest reply on Dec 21, 2009 9:05 PM by asaad970

    Publishing my flex application in external server (Channel.Security.Error error Error #2048)

    asaad970 Level 1

      when i publish my flex application in an external server i get that error if my flash builder beta 2 is closed in my system , i did configure an endpoint to the dataservice to point to the external server and if i run my flash builder and any body browser the site it open and they can access the data from my application but if i close my flash builder we have this error all of us
      Send failed
      Channel.Security.Error error Error #2048: Security sandbox violation:

      http://www.dcecrak.com/Maine.swf cannot load data from

      http://localhost:37813/flex2gateway/?hostport=www.dcecrak.com&https=N&id=-1. url:

      'http://www.dcecrak.com/flex2gateway/'

      i created a crossdomain.xml file and put it in the web root , if i try to open the link http://www.dcecrak.com/flex2gateway  it open with blank page this means that every thing is oky , my service-config file looks like that :

      <?xml version="1.0" encoding="UTF-8"?>
      <services-config>

          <services>
              <service-include file-path="remoting-config.xml" />
              <service-include file-path="proxy-config.xml" />
              <service-include file-path="messaging-config.xml" />
          </services>

          <security>
              <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
              <!-- Uncomment the correct app server
              <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
              <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
              <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
              -->
              <!--
              <security-constraint id="basic-read-access">
                  <auth-method>Basic</auth-method>
                  <roles>
                      <role>guests</role>
                      <role>accountants</role>
                      <role>employees</role>
                      <role>managers</role>
                  </roles>
              </security-constraint>
              -->
          </security>

          <channels>

              <!--  CF Based Endpoints -->

      <channel-definition id="dcecrak" class="mx.messaging.channels.AMFChannel">
                  <endpoint uri="http://www.dcecrak.com/flex2gateway/" class="coldfusion.flash.messaging.CFAMFEndPoint"/>
                  <properties>
                        <add-no-cache-headers>false</add-no-cache-headers>
                              <polling-interval-seconds>8</polling-interval-seconds>
                              <serialization>
                                    <enable-small-messages>false</enable-small-messages>
                              </serialization>
                              <coldfusion>
                                  <!-- define the resolution rules and access level of the cfc being invoked -->
                                    <access>
                                          <!-- Use the ColdFusion mappings to find CFCs-->
                                          <use-mappings>true</use-mappings>
                                          <!-- allow "public and remote" or just "remote" methods to be invoked -->
                                          <method-access-level>remote</method-access-level>
                                    </access>
                                   
                                    <!-- Whether the Value Object CFC has getters and setters. Set the value of use-accessors to true if there are getters and setters in the Value Object CFC. -->
                                    <use-accessors>true</use-accessors>
                                    <!--Set the value of use-structs to true if you don't require any translation of ActionScript to CFCs. The assembler can still return structures to Flex, even if the value is false. The default value is false.-->
                                    <use-structs>false</use-structs>

                          <property-case>
                              <!-- cfc property names -->
                              <force-cfc-lowercase>false</force-cfc-lowercase>
                              <!-- Query column names -->
                              <force-query-lowercase>false</force-query-lowercase>
                              <!-- struct keys -->
                              <force-struct-lowercase>false</force-struct-lowercase>
                          </property-case>
                              </coldfusion>
                  </properties>
              </channel-definition>
                 
              <channel-definition id="cf-polling-amf" class="mx.messaging.channels.AMFChannel">
                  <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/cfamfpolling" class="coldfusion.flash.messaging.CFAMFEndPoint"/>
                  <properties>
                      <polling-enabled>true</polling-enabled>
                      <polling-interval-seconds>8</polling-interval-seconds>
                              <serialization>
                                    <enable-small-messages>false</enable-small-messages>
                              </serialization>
                              <coldfusion>
                                  <!-- define the resolution rules and access level of the cfc being invoked -->
                                    <access>
                                          <!-- Use the ColdFusion mappings to find CFCs-->
                                          <use-mappings>true</use-mappings>
                                          <!-- allow "public and remote" or just "remote" methods to be invoked -->
                                          <method-access-level>remote</method-access-level>
                                    </access>
                                   
                                    <!-- Whether the Value Object CFC has getters and setters. Set the value of use-accessors to true if there are getters and setters in the Value Object CFC. -->
                                    <use-accessors>true</use-accessors>
                                    <!--Set the value of use-structs to true if you don't require any translation of ActionScript to CFCs. The assembler can still return structures to Flex, even if the value is false. The default value is false.-->
                                    <use-structs>false</use-structs>

                          <property-case>
                              <!-- cfc property names -->
                              <force-cfc-lowercase>false</force-cfc-lowercase>
                              <!-- Query column names -->
                              <force-query-lowercase>false</force-query-lowercase>
                              <!-- struct keys -->
                              <force-struct-lowercase>false</force-struct-lowercase>
                          </property-case>
                              </coldfusion>
                  </properties>
              </channel-definition>

              <channel-definition id="my-cfamf-secure" class="mx.messaging.channels.SecureAMFChannel">
                  <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/cfamfsecure" class="coldfusion.flash.messaging.SecureCFAMFEndPoint"/>
                  <properties>
                      <polling-enabled>false</polling-enabled>
                              <add-no-cache-headers>false</add-no-cache-headers>
                              <serialization>
                                    <enable-small-messages>false</enable-small-messages>
                              </serialization>
                              <coldfusion>
                                  <!-- define the resolution rules and access level of the cfc being invoked -->
                                    <access>
                                          <!-- Use the ColdFusion mappings to find CFCs-->
                                          <use-mappings>true</use-mappings>
                                          <!-- allow "public and remote" or just "remote" methods to be invoked -->
                                          <method-access-level>remote</method-access-level>
                                    </access>

                                    <!-- Whether the Value Object CFC has getters and setters. Set the value of use-accessors to true if there are getters and setters in the Value Object CFC. -->
                                    <use-accessors>true</use-accessors>
                                    <!--Set the value of use-structs to true if you don't require any translation of ActionScript to CFCs. The assembler can still return structures to Flex, even if the value is false. The default value is false.-->
                                    <use-structs>false</use-structs>
                                   
                                    <property-case>
                              <!-- cfc property names -->
                              <force-cfc-lowercase>false</force-cfc-lowercase>
                              <!-- Query column names -->
                              <force-query-lowercase>false</force-query-lowercase>
                              <!-- struct keys -->
                              <force-struct-lowercase>false</force-struct-lowercase>
                          </property-case>
                              </coldfusion>
                  </properties>
              </channel-definition>
            
              <!--  Java Based Endpoints -->
              <channel-definition id="java-amf" class="mx.messaging.channels.AMFChannel">
                  <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
              </channel-definition>

              <channel-definition id="java-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
                  <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
              </channel-definition>

              <channel-definition id="java-polling-amf" class="mx.messaging.channels.AMFChannel">
                  <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
                  <properties>
                      <polling-enabled>true</polling-enabled>
                      <polling-interval-seconds>8</polling-interval-seconds>
                  </properties>
              </channel-definition>

              <!--
              <channel-definition id="java-http" class="mx.messaging.channels.HTTPChannel">
                  <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
              </channel-definition>

              <channel-definition id="java-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
                  <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
              </channel-definition>
              -->
          </channels>

          <logging>
              <target class="flex.messaging.log.ConsoleTarget" level="Error">
                  <properties>
                      <prefix>[BlazeDS] </prefix>
                      <includeDate>false</includeDate>
                      <includeTime>false</includeTime>
                      <includeLevel>false</includeLevel>
                      <includeCategory>false</includeCategory>
                  </properties>
                  <filters>
                      <pattern>Endpoint.*</pattern>
                      <pattern>Service.*</pattern>
                      <pattern>Configuration</pattern>
                      <pattern>Message.*</pattern>
                  </filters>
              </target>
          </logging>

          <system>
              <manageable>false</manageable>
              <!--
              <redeploy>
                  <enabled>true</enabled>
                  <watch-interval>20</watch-interval>
                  <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
                  <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
                  <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>
                  <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>
                  <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>
                  <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
              </redeploy>
               -->
          </system>

      </services-config>


      and my crossdomain.xml looks like that :

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


      really its strange only the site works if my flash builder is running , please help

        • 1. Re: Publishing my flex application in external server (Channel.Security.Error error Error #2048)
          asaad970 Level 1

            Thanks all for your attention, i have solved my problem and i think its a bug in the flash builder , the problem was that when you compile the application and you enabling Network Monitoring , the communication of the AMF channels done throw the  http://localhost:37813/flex2gateway/
          and that was the problem if you close the flash builder on your system that getaway dose not exist and on the hosted server there is no such address localhost by this port also so the client application witch is catch in you system try to access your localhost and that cause a security error and the address is also not exist .

           

          so the solution or we have to compile the project after we disable the Network Monitoring in flash builder .