views:

487

answers:

1

My Cairngorm program does some preliminary authentication against a RemoteObject before allowing Cairngorm's ServiceLocator to start using the same RemoteObject to get business data. Everything works fine with Flex Builder, but I need an Ant build. The Ant mxmlc task compiles everything ok, but at runtime the resulting code fails at the getService() method on Cairngorm's RemoteObjects class, because it can't find the service.

Might this perhaps be due to the Cairngorm code being differently linked in the Ant-driven compilation? In the file resulting from -dump-config (and this file is fine, used with mxmlc on the command line) the only reference to the Cairngorm swc is in this element:

<library-path>
     <path-element>\path\to\directory\containing\Cairngorm.swc</path-element>
</library-path>

The corresponding element in my build.xml is

<compiler.library-path dir="${basedir}" append="true">
    <include name="libs"/>
</compiler.library-path>

I can't see anything that would affect how Cairngorm is linked, apart from an explicit setting of static-link-runtime-shared-libraries to true in both the FB output and in my build.xml. Perhaps my linking theory is all wrong? But what else could be making Cairngorm's remote access fail when access from elsewhere in the same SWF to the same RemoteObject has been ok?

A: 

It sounds like the ANT build might be missing the -services flag to compile in the services-config.xml file that configures the RemoteObject endpoints.

In FlexBuilder, look at the project properties and navigate to the Flex Compiler pane. You should see an "Additional Compiler Arguments" field. Make sure that these same additional arguments are passed to the ANT compile task. You're looking for something like "-services services-config.xml"

darronschall
Thanks for the suggestion - I can see the logic - but that's not it. The -services argument that I'm using for the Ant task is just the same as that in the services tag of the flex-config file that mxmlc uses. But an odd thing: compilation via Ant gives no errors when I give the -services argument directly - just fails to find the service - but when I remove it, hoping that the flex-config file that worked for mxmlc will work for the Ant task, it says that it's unable to open the /exact same/ file though flex-config that it just opened directly. Just another peculiarity of the Ant task?
mauricen