Search code examples
actionscript-3apache-flexblazeds

BlazeDS + Flash Builder: on setting web-application parameters


I have a working Flex/BlazeDS application (for simple AMF remoting) with the following settings:

server-config.xml:

<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
    <endpoint url="https://www.mydomain.com:443/myapp/messagebroker/amfsecure.amf" 
          class="flex.messaging.endpoints.AMFEndpoint"/>
    <properties>
        <add-no-cache-headers>false</add-no-cache-headers>
        <polling-enabled>false</polling-enabled>
    </properties>
</channel-definition>

and in Flash Builder 4.6 > Properties > Flex Server:

Root URL: http://www.mydomain.com/myapp
Context Root: /myapp/

The problem was I had all of my java files sitting in ONE directory at:

WEB-INF/classes/

and simply used the system default package (e.g. no package specified in the java files). Eventually, the sheer number of files became overwhelming. To improve my organization, I started using packages and in the process I created the following directories:

WEB-INF/classes/com/mydomain/
WEB-INF/classes/com/mydomain/mytools/
WEB-INF/classes/com/mydomain/hr/
WEB-INF/classes/com/mydomain/utilities/
etc...

Now there's no java files sitting in the WEB-INF/classes/ directory (they've been moved to it's various subdirectories).

My question is how to modify the services-config.xml file and/or Flash Builder > Properties > Flex Server settings? I've tried many different settings and I'm always getting the following error:

Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url:...

My thinking is that most people organize their projects using a WEB-INF/classes/com/mydomain/ architecture, so I'm hoping someone can share with me what their settings look like.

Adobe's website gives the following information but I don't see what I'm doing wrong: The root folder specifies the top-level directory of the web application (the directory that contains the WEB-INF directory). The root URL specifies the URL of the web application, and the context root specifies the root of the web application.

Thanks in advance for any comments/hints what to try.

UPDATE1:

Here's my destination (from remoting-config.xml):

<destination id="mySecureDestination">
    <channels>
        <channel ref="my-secure-amf"/>
    </channels>
        <properties>
            <source>myApplicationClass</source> 
            <scope>application</scope>
        </properties>
</destination>

Solution

  • In the source tag of your destination definition, you must write the full classpath of the class you are targetting. So assuming that you moved myApplicationClass to WEB-INF/classes/com/mydomain/, this should read:

    <destination id="mySecureDestination">
        <channels>
            <channel ref="my-secure-amf"/>
        </channels>
            <properties>
                <source>com.mydomain.myApplicationClass</source> 
                <scope>application</scope>
            </properties>
    </destination>