GWT 2.4 RequestFactory Exception when receiving data from BackEnd

698 views
Skip to first unread message

POODevelopper

unread,
Sep 15, 2011, 3:54:17 AM9/15/11
to Google Web Toolkit
Finally RequestFactory work with Spring back end, but I have another
issue : Is that i receive an exception on client when he process the
data, the server service is call but I get this exception on client.

Everything is set up correctly the Proxy Value Object, the Request
Object and the RequestFactory. I just can't determine the cause for
this exception it is making me crazy !!!

I tired to create a method on the service which return a simple String
and it work but for the complex type "GxpensesTransaction" no chance.
Below the exception I'm getting :

SEVERE: One or more exceptions caught, see full set in
UmbrellaException#getCauses
com.google.web.bindery.event.shared.UmbrellaException: One or more
exceptions caught, see full set in UmbrellaException#getCauses
at
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.fail(AbstractRequestContext.java:
727)
at
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext
$StandardPayloadDialect.processPayload(AbstractRequestContext.java:
331)
at
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext
$5.onTransportSuccess(AbstractRequestContext.java:1108)
at
com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport
$1.onResponseReceived(DefaultRequestTransport.java:136)
at
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
287)
at com.google.gwt.http.client.RequestBuilder
$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:
103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:
71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
337)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
218)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:
103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:
71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
292)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
546)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: Server Error: null
at
com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:
44)
at org.gxpenses.client.activity.AccountActivity
$1.onFailure(AccountActivity.java:81)
at
com.google.web.bindery.requestfactory.shared.impl.AbstractRequest.onFail(AbstractRequest.java:
118)
at
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.fail(AbstractRequestContext.java:
707)
at
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext
$StandardPayloadDialect.processPayload(AbstractRequestContext.java:
331)
at
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext
$5.onTransportSuccess(AbstractRequestContext.java:1108)
at
com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport
$1.onResponseReceived(DefaultRequestTransport.java:136)
at
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
287)
at com.google.gwt.http.client.RequestBuilder
$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:
103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:
71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
337)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
218)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:
103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:
71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
292)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
546)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
at java.lang.Thread.run(Thread.java:680)

Jens

unread,
Sep 15, 2011, 4:00:17 AM9/15/11
to google-we...@googlegroups.com
Caused by: java.lang.RuntimeException: Server Error: null at com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:44) 

So I would say you most likely have a Nullpointer Exception on server side while executing a service method.

-- J.

Ashwin Desikan

unread,
Sep 15, 2011, 4:02:28 AM9/15/11
to google-we...@googlegroups.com
Have u tried to override the onFailure and onviolation methods in ur Receiver? They give you better clarity on the error?

Do u any constraints/ validation on the entity? If they are not met your request would fail

Thanks
Ashwin

Sent from my iPhone

> --
> 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.
>

POODevelopper

unread,
Sep 15, 2011, 6:37:49 AM9/15/11
to Google Web Toolkit
I executed a JUnit Test on the services and there was no null pointer
Exception.
Also there is no constraint validation on the Entity. How can I make
the exception message more clear ??

Below the Code of the entity :

@Document(collection="transactions")
public class Transaction implements Serializable {

private static final long serialVersionUID = 4999532858364711856L;

@Id private ObjectId id;

@SuppressWarnings("unused")
private String strId;

@Indexed private ObjectId accountId;
@Indexed private ObjectId destTransactionId;
private String type;
private Date date;
private Double amount;
private String payee;
private String tags;

public Transaction() {
date = new Date();
}

public Transaction(String type, Date date, Double amount, String
payee) {
super();
this.type = type;
this.date = date;
this.amount = amount;
this.payee = payee;
}

public ObjectId getId() {
return id;
}

public void setId(ObjectId id) {
this.id = id;
}

public ObjectId getAccountId() {
return accountId;
}

public void setAccountId(ObjectId accountId) {
this.accountId = accountId;
}

public ObjectId getDestTransactionId() {
return destTransactionId;
}

public void setDestTransactionId(ObjectId destTransactionId) {
this.destTransactionId = destTransactionId;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
}

public Double getAmount() {
return amount;
}

public void setAmount(Double amount) {
this.amount = amount;
}

public String getPayee() {
return payee;
}

public void setPayee(String payee) {
this.payee = payee;
}

public String getTags() {
return tags;
}

public void setTags(String tags) {
this.tags = tags;
}

public List<String> getSplitedTags() {
List<String> tagsList = null;
if(tags != null)
tagsList = Arrays.asList(tags.split(" "));

return tagsList == null ? new ArrayList<String>() : tagsList;
}

public String getStrId() {
return getId().toStringMongod();
}

public void setStrId(String strId) {
this.strId = strId;
}
}

On Sep 15, 8:02 am, Ashwin Desikan <ashwin.desi...@gmail.com> wrote:
> Have u tried to override the onFailure and onviolation methods in ur Receiver? They give you better clarity on the error?
>
> Do u any constraints/ validation on the entity? If they are not met your request would fail
>
> Thanks
> Ashwin
>
> Sent from my iPhone
>
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChanne lServer.java:
> > 292)
> >    at
> > com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChan nelServer.java:
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChanne lServer.java:
> > 292)
> >    at
> > com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChan nelServer.java:

Thomas Broyer

unread,
Sep 15, 2011, 6:54:12 AM9/15/11
to google-we...@googlegroups.com
Put a breakpoint in com.google.web.bindery.requestfactory.server.DefaultExceptionHandler, or provide your own ExceptionHandler to the RequestFactoryServlet to log the exceptions (with their stacktrace).

POODevelopper

unread,
Sep 15, 2011, 4:56:10 PM9/15/11
to Google Web Toolkit
Thank you guys for the hint, I used this article to set up a proper
Exception handling :
http://cleancodematters.wordpress.com/2011/05/29/improved-exceptionhandling-with-gwts-requestfactory/

I have found that the Property "destTransactionId" was Null.
GWT need to handle Exceptions well Out of the Box. For a beginner it's
really difficult.
Reply all
Reply to author
Forward
0 new messages