Error: Injector is missing a rule........

Joe's Avatar


23 May, 2011 11:05 PM

I can't seem to figure out why I am getting the following error:

Error: Injector is missing a rule to handle injection into target [object IngredientInputMediator]. Target dependency: com.view.input::IngredientInput

The knowlege base states : "This error means that the injector has not been provided with an appropriate mapping to provide the dependency."

I have my view and mediator mapped in my context like so:
mediatorMap.mapView(IngredientInput, IngredientInputMediator);

and within my IngredientInputMediator I have the following:
[Inject] public var ingredient:IngredientInput;

I have does this several time throughout the rest of my app and all the others seem to work fine, does anyone have any possible ideas?


  1. Support Staff 1 Posted by Till Schneidere... on 23 May, 2011 11:36 PM

    Till Schneidereit's Avatar

    Hey Joe,

    that's weird. Are you perhaps creating the view in some other way than
    the others? Normally, the view is automatically mapped in the injector
    during creation of the mediator. Since I have no clue about how that
    could possibly go wrong, my best guess is that you're creating the
    mediator manually, but are still using the injector to do so.

    If that's not the case, could you perhaps post some code that shows
    the problem? If you don't feel like showing the code to everyone, you
    can either make the ticket private in Tender, which would cause only
    you and us members of the support-staff to be able to see it, or mail
    it to me directly at [email blocked].


  2. 2 Posted by Joe on 24 May, 2011 03:49 PM

    Joe's Avatar

    I figured it was weird. I don't have anything special going on. I have no issue posting the code, it is just an app I am building to learn Robot legs.
    override public function startup():void

            trace("\n", "Log - " + this);
            trace("     :: Dispatching ContextEvent.STARTUP_COMPLETE");
            dispatchEvent(new ContextEvent(ContextEvent.STARTUP_COMPLETE));
        // - PRIVATE METHODS - //
        private function mapViews():void
            trace("     :: Mapping Views to Mediators");
            mediatorMap.mapView(ServingSizeInput, ServingSizeMediator);
            mediatorMap.mapView(IngredientAmountInput, IngredientAmountMediator);
            mediatorMap.mapView(CalorieCountInput, CalorieCountMediator);
            mediatorMap.mapView(FatCountInput, FatCountMediator);
            mediatorMap.mapView(IngredientInput, IngredientInputMediator);
            mediatorMap.mapView(FoodCategoryInput, FoodCategoryMediator);
            mediatorMap.mapView(IngredientListLayout, IngredientListMediator);
            mediatorMap.mapView(IngredientLayout, IngredientInputMediator);
            mediatorMap.mapView(AddIngredientButton, AddIngredientMediator);
            mediatorMap.mapView(NewIngredientButton, NewIngredientMediator);

    <s:HGroup xmlns:fx=""

        <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:Label text="Ingredient"/>
    <s:TextInput width="152" id="Ingredient_TextFeild"/>

    public class IngredientInputMediator extends Mediator

        //- PROPERTIES - //
        [Inject] public var ingredientInput:IngredientInput;
        //- CONSTRUCTOR - //
        public function IngredientInputMediator()
        // - PUBLIC METHODS - //
        override public function onRegister():void
            trace("\n", "Log - " + this + ".onRegister()");
            trace("     :: the Ingredient Input View object has been injected, we have reference to that object");
            // The event map lets us listen for events broadcasted by view elements
            trace("     :: listening for events broadcasted by the IngredientInput view component");
            eventMap.mapListener(ingredientInput.Ingredient_TextFeild,FocusEvent.FOCUS_OUT, onExitFocus);
        // - PRIVATE METHODS - //
        private function onExitFocus(event:FocusEvent):void
            trace("\n", "Log - " + this + ".onExitFocus()");
            trace("     :: Dispatching the IngredientInputEvent.ADD_INGREDIENT event");
            dispatch(new IngredientInputEvent(IngredientInputEvent.ADD_INGREDIENT, event.currentTarget.text));
  3. 3 Posted by Joe on 24 May, 2011 03:54 PM

    Joe's Avatar

    related files attached. Thanks,

  4. Support Staff 4 Posted by Till Schneidere... on 24 May, 2011 04:09 PM

    Till Schneidereit's Avatar

    Mmh, from these files I can't see any problems that would cause the
    symptoms you're experiencing.

    I'm afraid I still can't help you based on the information I currently
    have. I would still offer you to send me the entire project by private
    mail. If you don't want to do that, maybe I can tell you something
    useful if you post the entire stacktrace from the exception you're

  5. 5 Posted by Stray on 24 May, 2011 04:18 PM

    Stray's Avatar

    I can't see anything here either (just as a sanity check for Till!)

    One question I have is whether the view is getting GC'd before the injection finishes... - though I'm not sure that's even possible, it depends whether Till has used his special weak references sauce in the injector at that point?

    Also willing to cast my eye over the stack trace here,


  6. Support Staff 6 Posted by Till Schneidere... on 24 May, 2011 04:31 PM

    Till Schneidereit's Avatar

    Thanks, Stray!

    GC can't be the culprit: A mapping response is always strongly
    referenced: How else would value and singleton mappings guarantee
    their responses?

  7. 7 Posted by Stray on 24 May, 2011 04:39 PM

    Stray's Avatar

    I thought as much - and the mediatorMap is using a hard reference... so... where on earth is it going? The mystery of the missing view...

  8. 8 Posted by Joe on 24 May, 2011 06:20 PM

    Joe's Avatar

    All seems to be working now, I deleted the reference to the IngredientInput component from my application, saved it and put it back. No more error. I should have just done this from the beginning, however I do appreciate you guys taking the time to look at my files in order to help me out.

    Thanks again,

  9. 9 Posted by Stray on 24 May, 2011 07:06 PM

    Stray's Avatar

    No worries Joe - and thank goodness it was just a corrupt file somewhere - I was really scratching my head there.

  10. Support Staff 10 Posted by Till Schneidere... on 24 May, 2011 07:53 PM

    Till Schneidereit's Avatar

    Thanks for the info - just as Stray, I'm glad you sorted it out and we
    didn't have to fix some odd corner-case.

  11. Ondina D.F. closed this discussion on 01 Nov, 2011 11:23 AM.

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

Keyboard shortcuts


? 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