tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/325-error-injector-is-missing-a-ruleRobotlegs: Discussion 2013-04-28T09:55:51Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-23T23:36:17Z2011-05-23T23:36:17ZError: Injector is missing a rule........<div><p>Hey Joe,</p>
<p>that's weird. Are you perhaps creating the view in some other
way than<br>
the others? Normally, the view is automatically mapped in the
injector<br>
during creation of the mediator. Since I have no clue about how
that<br>
could possibly go wrong, my best guess is that you're creating
the<br>
mediator manually, but are still using the injector to do so.</p>
<p>If that's not the case, could you perhaps post some code that
shows<br>
the problem? If you don't feel like showing the code to everyone,
you<br>
can either make the ticket private in Tender, which would cause
only<br>
you and us members of the support-staff to be able to see it, or
mail<br>
it to me directly at <a href=
"mailto:tschneidereit@gmail.com">tschneidereit@gmail.com</a>.</p>
<p>cheers,<br>
till</p></div>Till Schneidereittag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T15:49:51Z2011-07-21T14:50:12ZError: Injector is missing a rule........<div><p>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.</p>
<p>Context.as<br>
override public function startup():void</p>
<pre>
<code> {
trace("\n", "Log - " + this);
mapViews();
mapModels();
mapCommands();
mapServices();
trace(" :: Dispatching ContextEvent.STARTUP_COMPLETE");
dispatchEvent(new ContextEvent(ContextEvent.STARTUP_COMPLETE));
}
// - PRIVATE METHODS - //
private function mapViews():void
{
trace(" :: Mapping Views to Mediators");
//Inputs
mediatorMap.mapView(MealItemInput,MealItemMediator);
mediatorMap.mapView(ServingSizeInput, ServingSizeMediator);
mediatorMap.mapView(IngredientAmountInput, IngredientAmountMediator);
mediatorMap.mapView(CalorieCountInput, CalorieCountMediator);
mediatorMap.mapView(FatCountInput, FatCountMediator);
mediatorMap.mapView(IngredientInput, IngredientInputMediator);
//Dropdowns
mediatorMap.mapView(FoodCategoryInput, FoodCategoryMediator);
mediatorMap.mapView(ChooseIngredientInput,ChooseIngredientMediator);
//Layouts
mediatorMap.mapView(IngredientListLayout, IngredientListMediator);
mediatorMap.mapView(IngredientLayout, IngredientInputMediator);
//buttons
mediatorMap.mapView(AddIngredientButton, AddIngredientMediator);
mediatorMap.mapView(NewIngredientButton, NewIngredientMediator);
}</code>
</pre>
<p>IngredientInput.mxml<br>
<s:HGroup xmlns:fx="<a href=
"http://ns.adobe.com/mxml/2009">http://ns.adobe.com/mxml/2009</a>"</p>
<pre>
<code> xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="228"
height="30"
verticalAlign="middle"
paddingLeft="5"
paddingRight="5"
paddingTop="5"
paddingBottom="5">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Label text="Ingredient"/>
<s:TextInput width="152" id="Ingredient_TextFeild"/></code>
</pre>
<p></s:HGroup></p>
<p>ingredientInputMediator.as<br>
public class IngredientInputMediator extends Mediator</p>
<pre>
<code>{
//- PROPERTIES - //
[Inject] public var ingredientInput:IngredientInput;
//- CONSTRUCTOR - //
public function IngredientInputMediator()
{
super();
}
// - 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));
}
}</code>
</pre></div>Joetag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T15:54:30Z2011-05-24T15:54:33ZError: Injector is missing a rule........<div><p>related files attached. Thanks,</p></div>Joetag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T16:09:11Z2011-05-24T16:09:11ZError: Injector is missing a rule........<div><p>Mmh, from these files I can't see any problems that would cause
the<br>
symptoms you're experiencing.</p>
<p>I'm afraid I still can't help you based on the information I
currently<br>
have. I would still offer you to send me the entire project by
private<br>
mail. If you don't want to do that, maybe I can tell you
something<br>
useful if you post the entire stacktrace from the exception
you're<br>
getting.</p></div>Till Schneidereittag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T16:18:42Z2011-05-24T16:18:42ZError: Injector is missing a rule........<div><p>I can't see anything here either (just as a sanity check for
Till!)</p>
<p>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?</p>
<p>Also willing to cast my eye over the stack trace here,</p>
<p>Stray</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T16:31:08Z2011-05-24T16:31:08ZError: Injector is missing a rule........<div><p>Thanks, Stray!</p>
<p>GC can't be the culprit: A mapping response is always
strongly<br>
referenced: How else would value and singleton mappings
guarantee<br>
their responses?</p></div>Till Schneidereittag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T16:39:39Z2011-05-24T16:39:39ZError: Injector is missing a rule........<div><p>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...</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T18:20:48Z2011-05-24T18:20:52ZError: Injector is missing a rule........<div><p>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.</p>
<p>Thanks again,<br>
Joe</p></div>Joetag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T19:06:25Z2011-05-24T19:06:25ZError: Injector is missing a rule........<div><p>No worries Joe - and thank goodness it was just a corrupt file
somewhere - I was really scratching my head there.</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/74097502011-05-24T19:53:00Z2011-05-24T19:53:00ZError: Injector is missing a rule........<div><p>Thanks for the info - just as Stray, I'm glad you sorted it out
and we<br>
didn't have to fix some odd corner-case.</p></div>Till Schneidereit