Injector not working in FDT

Greg Kepler's Avatar

Greg Kepler

02 Aug, 2010 11:31 PM

I'm compiling my robotlegs project using FDT4 m3 and I'm getting the following error:

Exception fault: TypeError: Error #1009: Cannot access a property or method of a null object reference.

This error is in a Command class where I'm setting up my model. The model consists of:

package com.project.controllers 
{
import com.project.models.AppData;
import org.robotlegs.mvcs.Command;

public class ModelSetupCommand extends Command 
{

    override public function execute():void
    {
        trace("INJECTOR", this.injector);     // Traces to null
        injector.mapSingleton(AppData); 
    }
}
}

When I place the line

injector.mapSingleton(AppData);

in the context, it works fine. Also, it works fine when compiling using the CS3 to compile (with export SWC turned on). I get the same issue in every version of FDT that I've tried it with. This is a common convention that I use in my robotlegs projects and it all the sudden doesn't work. You think it's a robotlegs problem or an FDT problem?

Ideas?

  1. Support Staff 1 Posted by Shaun Smith on 02 Aug, 2010 11:41 PM

    Shaun Smith's Avatar

    Hi. It looks like the [Inject] metadata is being stripped out by the compiler (see: http://wiki.github.com/robotlegs/robotlegs-framework/common-problems ). Either use the Robotlegs SWC, or find out how to add the following compiler options in FDT:

    -keep-as3-metadata+=Inject -keep-as3-metadata+=PostConstruct
    
  2. 2 Posted by Greg Kepler on 02 Aug, 2010 11:54 PM

    Greg Kepler's Avatar

    Amazing. including the compiler option did it. Thanks man.

  3. Support Staff 3 Posted by Shaun Smith on 03 Aug, 2010 12:03 AM

    Shaun Smith's Avatar

    Cool, no problemo! Glad you're back on track.

  4. Shaun Smith closed this discussion on 03 Aug, 2010 12:03 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac