Misarable injector Problem

Gaurav Pandey's Avatar

Gaurav Pandey

22 Sep, 2012 04:33 PM

Dear All,

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:

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 "")

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

this i

However this error not hamper my functionality its works fine but this may result in application crash/hange when I prepare release builde.

Please find attcahed my source code containing (Context, service , Command and event class) for your reference

Please help
Regards,
Gaurav

  1. Support Staff 1 Posted by Ondina D.F. on 23 Sep, 2012 09:22 AM

    Ondina D.F.'s Avatar

    Hello Gaurav,
    I think, it's an event name collision. The constants of the 2 events have the same value of "Sucesses " and „Fail“.

    You have these constants:

    -GetProjectResultEvent

    public static const GET_PROJECT_RESULT_SUCCESS:String = "Sucesses";
    public static const GETPROJECT_RESULT_FAIL:String = "Fail";

    -AddProjectResultEvevnt

    public static const SUCESSES:String = "Sucesses";
    public static const FAIL:String = "Fail";

    and these mappings:
    commandMap.mapEvent(GetProjectResultEvent.GET_PROJECT_RESULT_SUCCESS,GetProjectResultCommand);

    commandMap.mapEvent(AddProjectResultEvevnt.SUCESSES,AddProjectResultCommand);

    Solution:

    • specify the eventClass for a stronger mapping (3rd parameter of commandMap.mapEvent):

    commandMap.mapEvent(AddProjectEvevnt.ADD_PROJECT,AddProjectCommand, AddProjectEvevnt);
    commandMap.mapEvent(GetProjectResultEvent.GET_PROJECT_RESULT_SUCCESS,GetProjectResultCommand, GetProjectResultEvent);

    • declaring constants like the following would be better

    GetProjectResultEvent

    public static const GET_PROJECT_RESULT_SUCCEEDED:String = "GetProjectSuceeded";
    public static const GET_PROJECT_RESULT_FAILED:String = "GetProjectFailed";

    AddProjectResultEvevnt

    public static const ADD_PROJECT_SUCCEEDED:String = "AddProjectSuceeded";
    public static const ADD_PROJECT_FAILED:String = "AddProjectFailed";

    or using Event’s fully qualified class path or other unique values of your choice:

    public static const ADD_PROJECT_ SUCCEEDED:String = „com.educomp.intelftp.events. AddProjectResultEvevnt.AddProjectSuceeded “;

    public static const GET_PROJECT_RESULT_ SUCCEEDED:String = „com.educomp.intelftp.events.GetProjectResultEvent.GetProjectSuceeded”
    .Suceeded“;

    Info about custom events and creating static constants for the Event.type property: http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e6...

    Also, it would be a good idea to override the clone method of your custom events: http://knowledge.robotlegs.org/kb/application-architecture/why-does...

    Let us know how it goes.
    Cheers,
    Ondina

  2. Support Staff 2 Posted by Ondina D.F. on 25 Sep, 2012 10:54 AM

    Ondina D.F.'s Avatar

    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.

  3. 3 Posted by gauravk.kumar on 27 Sep, 2012 11:07 AM

    gauravk.kumar's Avatar

    Dear Ondina,

    I will implement tonight what you have suggested and let you know . Sorry for not seeing the thread from last two days.

    Regards,
    Gaurav

  4. 4 Posted by gauravk.kumar on 28 Sep, 2012 03:24 AM

    gauravk.kumar's Avatar

    Dear Ondina.

    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.

    Regards,
    Gaurav

  5. Support Staff 5 Posted by Ondina D.F. on 28 Sep, 2012 07:24 AM

    Ondina D.F.'s Avatar

    You’re welcome, Gaurav! Glad it's working for you.

  6. Ondina D.F. closed this discussion on 28 Sep, 2012 07:24 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