I am still stuck here. I have seen this nice post
<http://stackoverflow.com/a/5642394/2819482>on SO and verified that I
comply to its recommendations.
- I don't store any RequestContext instance.
- I have two immutable EntityProxy that I retain beyond the duration of
their associated context's fire(). Since they are immutable that should be
fine
- I have a single RequestFactory initialized on entry point and injected
throughout my client using a Provider.
Still I do not know why one of my EntityProxy shows up as null on the
server's side (when it is not null on the client) while the other one works
OK (it is not null neither on the client).
Can someone suggest further debug steps for this issue? Is there something
in the EntityProxy instance that I should look at while debugging?
On Friday, 4 October 2013 00:23:56 UTC+2, Manu Botija wrote:
>
> Thanks, you are right, it was a NPE on one of the setters. I got confused
> thinking that the RF automatic validation would kick-in before the setters
> so I was not doing any checks... but I now realize that does not make
> sense. By the way, I set the breakpoint as suggested. I could see it was a
> NPE but it did not have any stacktrace. Luckily you had guessed it was one
> of the setters.
>
> Anyways, I have progressed with my understanding but the problem is still
> there:
> - I have two setters that take a EntityProxy as parameter.
> - On the client, both parameters are not null before calling the setters
> on the EntityProxy
> - One of the parameters is a EntityProxy retrieved by RequestFactory in
> the same Presenter from which I am launching my request (I am using GWTP)
> - The other one was retrieved by a different Presenter (although a priori
> using the same RequestFactory instance sine I inject it through a Provider)
> and then stored in an accessory class. That class is a singleton and is
> injected in the current Presenter. I therefore am retrieving this second
> parameter from that class just before calling the setter.
> - Now, the first parameters reaches the setter on the server and is
> not-null. However the second parameter when the server calls the setter is
> null.
>
> Is it possible that RequestFactory could have somehow forgot about the
> second parameter, and then cannot send it back to the server? (sorry if
> this is a dumb question: I am loving much of RequestFactory but still there
> are many things that scape my understanding)
>
> Any further pointer is appreciated.
>
> Note: I have also tried to fire the service using with() for both
> arguments (like one must do on the server-to-client Requests) but it has
> not make any difference for the better or worse.
>
>
> On Thursday, 3 October 2013 23:15:22 UTC+2, Thomas Broyer wrote:
>>
>>
>> On Thursday, October 3, 2013 9:50:17 PM UTC+2, Manu Botija wrote:
>>>
>>> Hi,
>>>
>>> Please let me know if this is not the place for this kind of questions...
>>>
>>> I am using *Objectify* with *RequestFactory*. I have an objectify *
>>> Entity* called *Entry* with an attribute of type Ref*<?>*. Following *
>>> Objectify* recommendations, I declare the getter and setter for that
>>> kind of argument as:
>>>
>>> * @Parent Ref<Topic> topic;*
>>>
>>> *public Topic getTopic() {*
>>>
>>> * return topic.get();*
>>>
>>> * }*
>>>
>>> **
>>>
>>> *public void setTopic(Topic topic) {*
>>>
>>> *this.topic = Ref.create(topic);*
>>>
>>> *}*
>>>
>>> *(Topic is an Entity as well)*
>>>
>>>
>>> Now on the client side I want to create a new *Entry* with some user
>>> content and attach to that *Entry* the *Topic* which I happen to have
>>> already in the client (brought it before with *RequestFactory*). So I
>>> do:
>>>
>>>
>>> entry.setText(review); //an String
>>>
>>> entry.setTopic(topic);
>>>
>>> entryService.saveEntry(entry).fire(new Receiver......)
>>>
>>>
>>> However, I always receive a very weird null Exception on the Receiver's
>>> onFailure:
>>>
>>>
>>> - getMessage gives: Error: Server Error: null
>>> - stacktracestring is null
>>> - requestContext
>>> is com.mmr.shared.service.EntryServiceImpl@5d95bef6, which is my service
>>> implementation but I have put a breakpoint and it never gets in.
>>>
>>> When I remove the *setTopic* call, the service succeeds (as long as I
>>> deal with the then null argument). So I believe the problem is in the
>>> setTopic but I don't know how to solve it neither how to workaround.
>>>
>>> Can you help me? I am a newbie to GWT and Web programming in general but
>>> this seems to me like pretty basic functionality in order to add items to a
>>> graph.
>>>
>>> Thanks!
>>>
>> Something (probably your setter) is throwing a NullPointerException
>> ('null' is a symptom of a NPE without specific message).
>>
>> Set a breakpoint in DefaultExceptionHandler#createServerFailure (on
>> server-side) so you have access to the exception with its stacktrace.
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.