Hi Carlos,

I would agree with you but the code that works in a non Crux project does
work when pasted into the Crux project. This code doesn't use any Crux
calls and returns the same error. Is it possible that the RemoteObject call
is compiled differently depending on the compiler instructions?

Thanks

David

On Fri., 26 Feb. 2021, 18:01 Carlos Rovira, <carlosrov...@apache.org> wrote:

> Hi, but that seems a problem in backend, not Royale.
> are you trying to go from very simple initial calls to more complex ones?
>
> El vie, 26 feb 2021 a las 16:38, David Slotemaker de Bruine (<
> dslotema...@vicensvives.com>) escribió:
>
>> There was an unhandled failure on the server.
>> java.lang.NullPointerException
>>
>> Not really helpful :)
>>
>> On Fri, 26 Feb 2021 at 16:18, Carlos Rovira <carlosrov...@apache.org>
>> wrote:
>>
>>> Hi,
>>>
>>> we need to see the NPE you refer
>>> thanks
>>>
>>> El vie, 26 feb 2021 a las 11:49, David Slotemaker de Bruine (<
>>> dslotema...@vicensvives.com>) escribió:
>>>
>>>> Hi Carlos,
>>>>
>>>> OK. Thanks.
>>>>
>>>> I think there is something wrong with the QuickStart project for Crux
>>>> for RemoteObjects and BlazeDS.
>>>>
>>>> I can now call the server but get NullPointer Exceptions as a result.
>>>>
>>>> So I tried in another project to make the same call having everything
>>>> in the same mxml (RemoteObject, Handles etc). This call works fine with the
>>>> exception of duplicate HTTP errors on the first call.
>>>>
>>>> When I take the same code and compile it in the crux project I still
>>>> get NullPointer exceptions. Could it be the compiler arguments?
>>>>
>>>> The project that works has:
>>>>
>>>> -theme=${royalelib}/themes/JewelTheme/src/main/resources/defaults.css
>>>> -html-template=src/resources/jewel-index-template.html
>>>> -js-library-path+=${royalelib}/js/libs/MXRoyaleJS.swc
>>>> -compiler.exclude-defaults-css-files=MXRoyaleJS.swc:defaults.css
>>>> +configname=flex   -js-library-path+=${royalelib}/js/libs/MXRoyaleJS.swc
>>>>
>>>> The Crux project has:
>>>> -theme=${royalelib}/themes/JewelTheme/src/main/resources/defaults.css
>>>> -html-template=src/main/resources/crux-jewel-example-index-template.html
>>>> -js-default-initializers=true
>>>> -keep-as3-metadata+=Inject,Dispatcher,EventHandler,PostConstruct,PreDestroy,ViewAdded,ViewRemoved,Bindable,Transient
>>>> -keep-code-with-metadata=Inject +configname=flex
>>>>  -js-library-path+=${royalelib}/js/libs/MXRoyaleJS.swc
>>>>
>>>> Any tips would be great,
>>>>
>>>> David
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, 25 Feb 2021 at 18:14, Carlos Rovira <carlosrov...@apache.org>
>>>> wrote:
>>>>
>>>>> Hi David,
>>>>>
>>>>> the class to be used on the Service class should be:
>>>>>
>>>>> mx.rpc.remoting.RemoteObject;
>>>>>
>>>>> while the class used when you add in bean provider mxml file is
>>>>> mx.rpc.remoting.mxml.RemoteObject;
>>>>> although is transparent to you since you use <mx:RemoteObject/>
>>>>> without the need of any import.
>>>>>
>>>>> HTH
>>>>>
>>>>> Carlos
>>>>>
>>>>>
>>>>> El jue, 25 feb 2021 a las 18:08, David Slotemaker de Bruine (<
>>>>> dslotema...@vicensvives.com>) escribió:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> So after talking with Piotr I found my problem was I hadn't added the
>>>>>> new Controller Component to the Beans.mxml. That is the key so that Crux
>>>>>> knows where to assign the events the app dispatches.
>>>>>>
>>>>>> One issue we did run into was that the definition of the
>>>>>> RemoteObjects weren't detected when they where defined in a seperate
>>>>>> ServicesConfig.mxml within the config directory. Even though this file 
>>>>>> was
>>>>>> referenced in <crux:beanProviders>.
>>>>>>
>>>>>> Adding the remote object definitions directly to Beans.mxl was the
>>>>>> key.
>>>>>>
>>>>>> Also when Injecting the RemoteObject into the new XXXService.as file
>>>>>> it is of type:
>>>>>>
>>>>>> mx.rpc.remoting.mxml.RemoteObject;
>>>>>>
>>>>>> I now have issues getting the correct response from the server, but
>>>>>> that will be another post :)
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, 25 Feb 2021 at 08:42, David Slotemaker de Bruine <
>>>>>> dslotema...@vicensvives.com> wrote:
>>>>>>
>>>>>>> Hi Piotr, I will send you a link with the code, cheers! I will then
>>>>>>> post the solution back here when we find it!
>>>>>>>
>>>>>>> David
>>>>>>>
>>>>>>> On Wed, 24 Feb 2021 at 17:23, Piotr Zarzycki <
>>>>>>> piotrzarzyck...@gmail.com> wrote:
>>>>>>>
>>>>>>>> David,
>>>>>>>>
>>>>>>>> You can send me code of your project and I will take a look at it.
>>>>>>>> I don't see any connection to Moonshine here. We need more data to help
>>>>>>>> you. The best would be if you could provide source code by uploading on
>>>>>>>> some server - if you can of course.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Piotr
>>>>>>>>
>>>>>>>> śr., 24 lut 2021 o 17:13 Carlos Rovira <carlosrov...@apache.org>
>>>>>>>> napisał(a):
>>>>>>>>
>>>>>>>>> Hi David,
>>>>>>>>>
>>>>>>>>> the two lines refers to 2 injects in UserController. Since I don't
>>>>>>>>> know the code I guess you have 2 injections there.
>>>>>>>>> You talk then about a "usuarioController", but I don't know what
>>>>>>>>> is. Is not UserController? is other controller? then you need to add 
>>>>>>>>> as
>>>>>>>>> well to your beanprovider.
>>>>>>>>>
>>>>>>>>> About Moonshine, maybe @Piotr Zarzycki <piotrzarzyck...@gmail.com> can
>>>>>>>>> help you I don't have many experience, sorry
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> El mar, 23 feb 2021 a las 15:18, David Slotemaker de Bruine (<
>>>>>>>>> dslotema...@vicensvives.com>) escribió:
>>>>>>>>>
>>>>>>>>>> Hi Carlos,
>>>>>>>>>>
>>>>>>>>>> OK,
>>>>>>>>>>
>>>>>>>>>> I created everything you said, a new:
>>>>>>>>>>
>>>>>>>>>> ServicesConfig.mxml in the config folder and pointed to it
>>>>>>>>>> in <crux:beanProviders>
>>>>>>>>>>
>>>>>>>>>> Then I created:
>>>>>>>>>> UsuarioController
>>>>>>>>>> UsuarioEvent
>>>>>>>>>> UsusarioService
>>>>>>>>>>
>>>>>>>>>> for my "usuario" needs.
>>>>>>>>>>
>>>>>>>>>> The thing is, It does seem that the new controller is being
>>>>>>>>>> referenced during compile time. I Get the following:
>>>>>>>>>>
>>>>>>>>>> Activating JSStageEvents
>>>>>>>>>> : InjectProcessor set up [Inject] on Bean{ source: [object
>>>>>>>>>> Object], name: userController }
>>>>>>>>>> : InjectProcessor set up [Inject] on Bean{ source: [object
>>>>>>>>>> Object], name: userController }
>>>>>>>>>> : [PostConstruct] executing createDefaultUser in UserController
>>>>>>>>>> : [JS] application setUp stub
>>>>>>>>>>
>>>>>>>>>> 2 for userController but none for usuarioController.
>>>>>>>>>>
>>>>>>>>>> When I call the UsuarioEvent, it dispatchers but doesn't get sent
>>>>>>>>>> to the UsuarioController. The userEvent dispatch correctly and is 
>>>>>>>>>> sent to
>>>>>>>>>> the UserContoller without a problem.
>>>>>>>>>>
>>>>>>>>>> 2 additional points of information.
>>>>>>>>>>
>>>>>>>>>> 1. Breakpoints (In Moonshine) are not working in the project, but
>>>>>>>>>> they are in others.
>>>>>>>>>> 2. There is a blue squiggle at the start of some of the files
>>>>>>>>>> stating that the files are not within the source directory, but they 
>>>>>>>>>> are.
>>>>>>>>>>
>>>>>>>>>>  Any ideas?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thu, 18 Feb 2021 at 17:42, David Slotemaker de Bruine <
>>>>>>>>>> dslotema...@vicensvives.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Great! Thank you!
>>>>>>>>>>>
>>>>>>>>>>> I will give it a shot!
>>>>>>>>>>>
>>>>>>>>>>> On Thu, 18 Feb 2021 at 17:07, Carlos Rovira <
>>>>>>>>>>> carlosrov...@apache.org> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> ok, let's go:
>>>>>>>>>>>>
>>>>>>>>>>>> 1.- REMOTEOBJECTS: You will have a mxml file that extends from
>>>>>>>>>>>> Crux BeanProvider. Let's call it ServicesConfig.mxml. There you 
>>>>>>>>>>>> have all
>>>>>>>>>>>> you mx:RemoteObject objects. So this object will provide all 
>>>>>>>>>>>> remote objects
>>>>>>>>>>>> to the rest of your app:
>>>>>>>>>>>>
>>>>>>>>>>>> <mx:RemoteObject id="loginService"
>>>>>>>>>>>> destination="loginService"
>>>>>>>>>>>> channelSet="{loginChannel}"
>>>>>>>>>>>> showBusyCursor="true"/>
>>>>>>>>>>>>
>>>>>>>>>>>> 2.- SERVICE: Then you have a "delegate" like in Cairngorm where
>>>>>>>>>>>> you inject the remote object:
>>>>>>>>>>>>
>>>>>>>>>>>> [Inject(source="loginService", required="true")]
>>>>>>>>>>>> public var service :RemoteObject = null;
>>>>>>>>>>>>
>>>>>>>>>>>> So the remoteobject with name "loginService" will be injected
>>>>>>>>>>>> in the public var service. In this delegate you can do things like 
>>>>>>>>>>>> this:
>>>>>>>>>>>>
>>>>>>>>>>>> public function recoverPassword(username :String, password :
>>>>>>>>>>>> String) :AsyncToken {
>>>>>>>>>>>> return service.recoverPassword(username, password);
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> 3.- CONTROLLER: Here you have controller methods that will be
>>>>>>>>>>>> called with events and this will in the end call service methods 
>>>>>>>>>>>> in the
>>>>>>>>>>>> delegate layer:
>>>>>>>>>>>>
>>>>>>>>>>>> [EventHandler(event="LoginEvent.RECOVER_PASSWORD", properties=
>>>>>>>>>>>> "password")]
>>>>>>>>>>>> public function passwordRecovery(password :String) :void {
>>>>>>>>>>>> executeServiceCall(loginDelegate.recoverPassword(model.recoverUsername,
>>>>>>>>>>>> password), passwordRecoveryHandler);
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> executeServiceCall is a Crux function that allow you to call a
>>>>>>>>>>>> service method and attach a result and fault handlers that will be 
>>>>>>>>>>>> on this
>>>>>>>>>>>> controller. So in a controller you have that method plus two 
>>>>>>>>>>>> handlers
>>>>>>>>>>>> (result and fault, but probably just the first since the second 
>>>>>>>>>>>> use to be
>>>>>>>>>>>> the same reusable for all)
>>>>>>>>>>>>
>>>>>>>>>>>> 4.- EVENT: You extend from CruxEvent and have things like this:
>>>>>>>>>>>>
>>>>>>>>>>>> public static const RECOVER_PASSWORD:String =
>>>>>>>>>>>> "login.recoverPassword";
>>>>>>>>>>>>
>>>>>>>>>>>> that match with the one in the controller.
>>>>>>>>>>>>
>>>>>>>>>>>> 5.- VIEW: Here you send the event:
>>>>>>>>>>>>
>>>>>>>>>>>> var event :LoginEvent = new LoginEvent(LoginEvent.
>>>>>>>>>>>> RECOVER_PASSWORD);
>>>>>>>>>>>> event.password = newpassword.text;
>>>>>>>>>>>> dispatchEvent(event);
>>>>>>>>>>>>
>>>>>>>>>>>> And that's all
>>>>>>>>>>>>
>>>>>>>>>>>> I think this is a very simple but powerful arquitecture that
>>>>>>>>>>>> allows to organize code in a very good way, while using plain 
>>>>>>>>>>>> objects
>>>>>>>>>>>> without the need of extensions and more, since objects are 
>>>>>>>>>>>> injected.
>>>>>>>>>>>>
>>>>>>>>>>>> HTH
>>>>>>>>>>>>
>>>>>>>>>>>> Carlos
>>>>>>>>>>>>
>>>>>>>>>>>> El jue, 18 feb 2021 a las 16:51, Carlos Rovira (<
>>>>>>>>>>>> carlosrov...@apache.org>) escribió:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi David,
>>>>>>>>>>>>>
>>>>>>>>>>>>> we have it here [1], but anyway I'll try to give a bit more
>>>>>>>>>>>>> info.
>>>>>>>>>>>>>
>>>>>>>>>>>>> [1]
>>>>>>>>>>>>> https://apache.github.io/royale-docs/libraries/crux/service-layer
>>>>>>>>>>>>>
>>>>>>>>>>>>> El jue, 18 feb 2021 a las 16:49, Carlos Rovira (<
>>>>>>>>>>>>> carlosrov...@apache.org>) escribió:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi David,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I'll try to write this on a wiki, since I don't think we have
>>>>>>>>>>>>>> a working example. Hope to come back to you soon.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> El jue, 18 feb 2021 a las 15:54, David Slotemaker de Bruine (<
>>>>>>>>>>>>>> dslotema...@vicensvives.com>) escribió:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi All,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I come from a Flex Cairngorm background and I am trying to
>>>>>>>>>>>>>>> get my head around Crux and the Crux example.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I have gone through the tutorial and read the documentation.
>>>>>>>>>>>>>>> But I am stuck on where to place my RemoteObject tags and how to
>>>>>>>>>>>>>>> reference/call them.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The first code snippet from:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> https://apache.github.io/royale-docs/libraries/crux/service-layer
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Shows the injection of a "userService" RemoteObject and a
>>>>>>>>>>>>>>> "ServiceHelper". Where should these code if I am using the 
>>>>>>>>>>>>>>> CruxQuickStart
>>>>>>>>>>>>>>> as a base? In UserService.as? Where should the 
>>>>>>>>>>>>>>> <mx:RemoteObject> be defined
>>>>>>>>>>>>>>> so it can be injected?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Any help would be great!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> David
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Carlos Rovira
>>>>>>>>>>>>>> Apache Member & Apache Royale PMC
>>>>>>>>>>>>>> *Apache Software Foundation*
>>>>>>>>>>>>>> http://about.me/carlosrovira
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> Carlos Rovira
>>>>>>>>>>>>> Apache Member & Apache Royale PMC
>>>>>>>>>>>>> *Apache Software Foundation*
>>>>>>>>>>>>> http://about.me/carlosrovira
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Carlos Rovira
>>>>>>>>>>>> Apache Member & Apache Royale PMC
>>>>>>>>>>>> *Apache Software Foundation*
>>>>>>>>>>>> http://about.me/carlosrovira
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>> *David Slotemaker de Bruïne*
>>>>>>>>>>> *Head of Educational Robotics*
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Av. Sarriá, 130 - 08017 Barcelona
>>>>>>>>>>> <https://maps.google.com/?q=Av.+Sarri%C3%A1,+130+-+08017+Barcelona&entry=gmail&source=g>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> T. +34 932 523 729 ext. 135
>>>>>>>>>>>
>>>>>>>>>>> dslotema...@vicensvives.com
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> *David Slotemaker de Bruïne*
>>>>>>>>>> *Head of Educational Robotics*
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Av. Sarriá, 130 - 08017 Barcelona
>>>>>>>>>> <https://maps.google.com/?q=Av.+Sarri%C3%A1,+130+-+08017+Barcelona&entry=gmail&source=g>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> T. +34 932 523 729 ext. 135
>>>>>>>>>>
>>>>>>>>>> dslotema...@vicensvives.com
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Carlos Rovira
>>>>>>>>> Apache Member & Apache Royale PMC
>>>>>>>>> *Apache Software Foundation*
>>>>>>>>> http://about.me/carlosrovira
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Piotr Zarzycki
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> *David Slotemaker de Bruïne*
>>>>>>> *Head of Educational Robotics*
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Av. Sarriá, 130 - 08017 Barcelona
>>>>>>> <https://maps.google.com/?q=Av.+Sarri%C3%A1,+130+-+08017+Barcelona&entry=gmail&source=g>
>>>>>>>
>>>>>>>
>>>>>>> T. +34 932 523 729 ext. 135
>>>>>>>
>>>>>>> dslotema...@vicensvives.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> *David Slotemaker de Bruïne*
>>>>>> *Head of Educational Robotics*
>>>>>>
>>>>>>
>>>>>>
>>>>>> Av. Sarriá, 130 - 08017 Barcelona
>>>>>> <https://maps.google.com/?q=Av.+Sarri%C3%A1,+130+-+08017+Barcelona&entry=gmail&source=g>
>>>>>>
>>>>>>
>>>>>> T. +34 932 523 729 ext. 135
>>>>>>
>>>>>> dslotema...@vicensvives.com
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Carlos Rovira
>>>>> Apache Member & Apache Royale PMC
>>>>> *Apache Software Foundation*
>>>>> http://about.me/carlosrovira
>>>>>
>>>>>
>>>>
>>>> --
>>>>
>>>> *David Slotemaker de Bruïne*
>>>> *Head of Educational Robotics*
>>>>
>>>>
>>>>
>>>> Av. Sarriá, 130 - 08017 Barcelona
>>>> <https://maps.google.com/?q=Av.+Sarri%C3%A1,+130+-+08017+Barcelona&entry=gmail&source=g>
>>>>
>>>>
>>>> T. +34 932 523 729 ext. 135
>>>>
>>>> dslotema...@vicensvives.com
>>>>
>>>
>>>
>>> --
>>> Carlos Rovira
>>> Apache Member & Apache Royale PMC
>>> *Apache Software Foundation*
>>> http://about.me/carlosrovira
>>>
>>>
>>
>> --
>>
>> *David Slotemaker de Bruïne*
>> *Head of Educational Robotics*
>>
>>
>>
>> Av. Sarriá, 130 - 08017 Barcelona
>> <https://maps.google.com/?q=Av.+Sarri%C3%A1,+130+-+08017+Barcelona&entry=gmail&source=g>
>>
>>
>> T. +34 932 523 729 ext. 135
>>
>> dslotema...@vicensvives.com
>>
>
>
> --
> Carlos Rovira
> Apache Member & Apache Royale PMC
> *Apache Software Foundation*
> http://about.me/carlosrovira
>
>

Reply via email to