tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/646-misarable-injector-problemRobotlegs: Discussion 2012-09-28T07:24:10Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/189488142012-09-22T16:33:13Z2012-09-22T16:33:17ZMisarable injector Problem<div><p>Dear All,</p>
<p>I am creating a project on RobotLegs + Flex 4 +Spring. I have
implemented one command perfectly but when i map second command
RobotLeg throws error:</p>
<p>Main Thread (Suspended: Error: Injector is missing a rule to
handle injection into property "addProjectResultEvt" of object
"[object AddProjectResultCommand]". Target dependency:
"com.educomp.intelftp.events::AddProjectResultEvevnt", named
"")</p>
<pre>
<code>org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection
org.swiftsuspenders::Injector/injectInto
org.swiftsuspenders::Injector/instantiate
org.robotlegs.base::CommandMap/execute
org.robotlegs.base::CommandMap/routeEventToCommand
<anonymous>
flash.events::EventDispatcher/dispatchEventFunction [no source]
flash.events::EventDispatcher/dispatchEvent [no source]
org.robotlegs.mvcs::Actor/dispatch
com.educomp.intelftp.services::ProjectService/handleGetProjectResult
flash.events::EventDispatcher/dispatchEventFunction [no source]
flash.events::EventDispatcher/dispatchEvent [no source]
mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler
mx.rpc::Responder/result
mx.rpc::AsyncRequest/acknowledge
NetConnectionMessageResponder/resultHandler
mx.messaging::MessageResponder/result</code>
</pre>
<p>this i</p>
<p>However this error not hamper my functionality its works fine
but this may result in application crash/hange when I prepare
release builde.</p>
<p>Please find attcahed my source code containing (Context, service
, Command and event class) for your reference</p>
<p>Please help<br>
Regards,<br>
Gaurav</p></div>Gaurav Pandeytag:robotlegs.tenderapp.com,2009-10-18:Comment/189488142012-09-23T09:22:38Z2012-09-23T09:54:29ZMisarable injector Problem<div><p>Hello Gaurav,<br>
I think, it's an event name collision. The constants of the 2
events have the same value of "Sucesses " and
„Fail“.</p>
<p>You have these constants:</p>
<p>-GetProjectResultEvent</p>
<p>public static const GET_PROJECT_RESULT_SUCCESS:String =
"Sucesses";<br>
public static const GETPROJECT_RESULT_FAIL:String = "Fail";</p>
<p>-AddProjectResultEvevnt</p>
<p>public static const SUCESSES:String = "Sucesses";<br>
public static const FAIL:String = "Fail";</p>
<p>and these mappings:<br>
commandMap.mapEvent(GetProjectResultEvent.GET_PROJECT_RESULT_SUCCESS,GetProjectResultCommand);</p>
<p>
commandMap.mapEvent(AddProjectResultEvevnt.SUCESSES,AddProjectResultCommand);</p>
<p>Solution:</p>
<ul>
<li>specify the eventClass for a stronger mapping (3rd parameter of
commandMap.mapEvent):</li>
</ul>
<p>
commandMap.mapEvent(AddProjectEvevnt.ADD_PROJECT,AddProjectCommand,
<strong>AddProjectEvevnt</strong>);<br>
commandMap.mapEvent(GetProjectResultEvent.GET_PROJECT_RESULT_SUCCESS,GetProjectResultCommand,
<strong>GetProjectResultEvent</strong>);</p>
<ul>
<li>declaring constants like the following would be better</li>
</ul>
<p>GetProjectResultEvent</p>
<p>public static const GET_PROJECT_RESULT_SUCCEEDED:String =
"<strong>GetProjectSuceeded</strong>";<br>
public static const GET_PROJECT_RESULT_FAILED:String =
"<strong>GetProjectFailed</strong>";</p>
<p>AddProjectResultEvevnt</p>
<p>public static const ADD_PROJECT_SUCCEEDED:String =
"<strong>AddProjectSuceeded</strong>";<br>
public static const ADD_PROJECT_FAILED:String =
"<strong>AddProjectFailed</strong>";</p>
<p>or using Event’s fully qualified class path or other
unique values of your choice:</p>
<p>public static const ADD_PROJECT_ SUCCEEDED:String =
„com.educomp.intelftp.events.
AddProjectResultEvevnt.AddProjectSuceeded “;</p>
<p>public static const GET_PROJECT_RESULT_ SUCCEEDED:String =
„com.educomp.intelftp.events.GetProjectResultEvent.GetProjectSuceeded”<br>
.Suceeded“;</p>
<p>Info about custom events and creating static constants for the
Event.type property: <a href=
"http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf67fe7-7ffd.html">
http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e6...</a></p>
<p>Also, it would be a good idea to override the clone method of
your custom events: <a href=
"http://knowledge.robotlegs.org/kb/application-architecture/why-doesnt-my-event-trigger-the-command-it-is-mapped-to">
http://knowledge.robotlegs.org/kb/application-architecture/why-does...</a></p>
<p>Let us know how it goes.<br>
Cheers,<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/189488142012-09-25T10:54:00Z2012-09-25T10:54:00ZMisarable injector Problem<div><p>Gaurav, please let us know if you solved your problem already,
so we can mark the discussion as resolved, or provide more
assistance in case the issues still persist.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/189488142012-09-27T11:07:27Z2012-09-27T11:07:27ZMisarable injector Problem<div><p>Dear Ondina,</p>
<p>I will implement tonight what you have suggested and let you
know . Sorry for not seeing the thread from last two days.</p>
<p>Regards,<br>
Gaurav</p></div>gauravk.kumartag:robotlegs.tenderapp.com,2009-10-18:Comment/189488142012-09-28T03:24:44Z2012-09-28T03:24:44ZMisarable injector Problem<div><p>Dear Ondina.</p>
<p>Thanks for pointing me such a small error . It is a lesson
learnt for me. My problem has been solved . Now I am going to close
the thread as solved.</p>
<p>Regards,<br>
Gaurav</p></div>gauravk.kumartag:robotlegs.tenderapp.com,2009-10-18:Comment/189488142012-09-28T07:24:08Z2012-09-28T07:24:08ZMisarable injector Problem<div><p>You’re welcome, Gaurav! Glad it's working for you.</p></div>Ondina D.F.