RequestFactory Imposible To use

86 views
Skip to first unread message

MagusDrk

unread,
Dec 21, 2011, 1:07:58 PM12/21/11
to Google Web Toolkit
Hi everybody!

I have two weeks trying to implement RequestFactory, I've done my data
classes model, locators, proxies, etc, but I simply can't get it to
work. I've tried all configurations suggested on Starting With Requst
Factory Page, but I still get the same problem.

When the line request.fire(new Receiver<Myobject>() {... It simply
goes to public void onFailure(ServerFailure error) {... method. and
never reaches the server side. All error detail is a "Server Error:
null" (absolutelly nothing else)

It's really important to me make ir work as quickly as posible, so, a
quick answer will be too much appreciated.

Some details:

// MyEntityProxy entity =
context.create(EspacioCorporativoProxy.class);
// MyValue administrador = context.create(UsuarioProxy.class);
//
// some set calls
//
// Request<SharedTipe> request = context.createMyEntity(entity);
// request.fire(new Receiver<SharedTipe>() {
//
// @Override
// public void onFailure(ServerFailure error) {
// ... error handing
//
// try {
// super.onFailure(error);
// } catch (Throwable t) {
// GWT.getUncaughtExceptionHandler().onUncaughtException(t);
// }
// }
//
// @Override
// public void onSuccess(ResultadoRegistro response) {
// ... success handing
// ... never reached, so, doesn't mean.
// }
// });

public class MyService {

@ServiceMethod
public SharedTipe createMyEntity(MyEntity entity) {
PersistenceAccess() g = new PersistenceAccess();
SharedTipe result = g.createMyEntity(entity); //g saves the entity
in the datastorage an return a flag
return result;
}

}

@ProxyForName(value = "com.xxx.app.server.domain.MyEntity", locator =
"com.xxx.app.server.locator.MyEntityLocator")
public interface EspacioCorporativoProxy extends EntityProxy {

... normal getters and setters
}

MagusDrk

unread,
Dec 21, 2011, 1:15:30 PM12/21/11
to Google Web Toolkit

Thomas Broyer

unread,
Dec 21, 2011, 1:33:18 PM12/21/11
to google-we...@googlegroups.com
When you say "never reaches the server side", you mean it never reaches your own code, right? Have you looked at the server logs?

You might be interested by http://code.google.com/p/google-web-toolkit/wiki/RequestFactory_2_4#RequestFactorySource_and_Annotation_Processing too, which is unfortunately missing from the docs (it was originally scheduled for 2.5).

Aidan O'Kelly

unread,
Dec 21, 2011, 2:08:45 PM12/21/11
to google-we...@googlegroups.com
On Wed, Dec 21, 2011 at 6:07 PM, MagusDrk <magu...@googlemail.com> wrote:
never reaches the server side. All error detail is a "Server Error:
null" (absolutelly nothing else)

 
RequestFactoryServlet by default catches all exceptions and returns them to the client, without stack-traces or much details, I usually get this error if my service method throws a NPE.

If you have a look at RequestFactoryServlet , you can see the no-arg constructor creates a 'DefaultExceptionHandler', which generates this 'Server Error:...'  message.  You can subclass RequestFactoryServlet and use your own handler which logs the stack trace, etc. 

In short, something on the server side is throwing an exception. Are you positive your server side code is not being reached? It could be the locator that is that is throwing the exception. 

MagusDrk

unread,
Dec 21, 2011, 3:13:45 PM12/21/11
to Google Web Toolkit
Hi, Thomas, I've read the RequestFactorySource and Annotation
Processing. I have already the requestfactory-apt.jar referenced as it
is shown in the link bellow, but it doesn't seem to be the problem.
Right now I'm trying to implement something in order to catch the
server side exception as Aidan has suggested. Thanks a lot!

http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation



On 21 dic, 13:33, Thomas Broyer <t.bro...@gmail.com> wrote:
> When you say "never reaches the server side", you mean it never reaches
> your own code, right? Have you looked at the server logs?
>
> You might be interested byhttp://code.google.com/p/google-web-toolkit/wiki/RequestFactory_2_4#R...too,

MagusDrk

unread,
Dec 21, 2011, 3:33:29 PM12/21/11
to Google Web Toolkit
Aidan, thanks by your answer.

When I said my server side is not reached, I reffer to some
breakpoints in the back-end wich are never reached on debug mode (in
the Service class in server side). just after calling the fire method,
the debug stake catches another breakpoint in the onFailure method of
the request (but never someone of the server side). That's why I said
my server code is not reached.

I'm trying to implement something in the server side to catch that
exception you said, but I'm not sure about how to do it (break points
are never catched).

Thanks again.

Magus.

MagusDrk

unread,
Dec 21, 2011, 6:37:58 PM12/21/11
to Google Web Toolkit
Hi all again! I've just tried to use a CustomRequestFactoryServlet in
order to catch and resolve the NPE in the server side. I could do it,
but the catched error was "NullPointerException" with no other info
(at all), no strackTrace, no specific cause (just "null") and no
location specified! Help, please, I had to avoid using RequestFactory
for my week release, but I Have to get it working soon. If you need
some specific information, please, let me know.

Aidan O'Kelly

unread,
Dec 21, 2011, 6:44:04 PM12/21/11
to google-we...@googlegroups.com
Give this a try: 

Start in debug mode,
1 - Get the app ready to fire() your request,
*then*
2 - In eclipse, add Java Exception Breakpoint on java.lang.NullPointerException - make sure 'caught exceptions' is ticked.
3 - Make your app fire() the request. 

You should drop into debug mode when the NPE is thrown and be able to work back through the stacktrace.  
If you do step 2 before step 1, you will catch some unrelated exceptions, which are normally handled OK (since they are caught exceptions), so this is a kinda awkard way to do it, but it should let you find the problem. 



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


MagusDrk

unread,
Dec 26, 2011, 5:11:05 PM12/26/11
to Google Web Toolkit
Hi Aidan.

I did what you said about catch the null pointer exception, It looked
like the servlet for the request factory was bad mapped (but it was
never warned on compilation/excecution time). I re-mapped the servlet
as the bellow page says and it worked (for now, because I proved with
the more simple case). Thanks a lot to all of you. I'll be commenting
again when find those "imposible" cases.

Thanks again.

Magus

http://code.google.com/intl/es-ES/webtoolkit/doc/latest/DevGuideRequestFactory.html#wiring
Reply all
Reply to author
Forward
0 new messages