Wednesday, May 20, 2015

Re: GWT RPC : remote call

that is because d_entity[0] contains null. You only allocated the array but not the Data_entity objects.

On Wed, May 20, 2015 at 4:51 PM, <meljair@spraytalent.com> wrote:
Hi all, 

I got an error in my GWT application, when i call a server side methode to get Data in order to display them in a pieChart (GWT visualization), here is the code : 

Server Side : 

public class SpdhServiceImpl extends RemoteServiceServlet implements
SpdhService {

/**
*/
private static final long serialVersionUID = 1L;

@Override
public  Data_entity[] getEmployeesByCity()  {
Data_entity[] d_entity = new Data_entity[5] ;
d_entity[0].setCity("Casablanca");
d_entity[0].setCount(23);
return  d_entity ;
}

}


Errors:

First part : 

PM com.google.appengine.tools.development.ApiProxyLocalImpl log

GRAVE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call

com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.spt.sprd.shared.Data_entity[] 

com.spt.sprd.client.SpdhService.getEmployeesByCity() throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.NullPointerException

at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)


Second part : 

Caused by: java.lang.NullPointerException
at com.spt.sprd.server.SpdhServiceImpl.getEmployeesByCity(SpdhServiceImpl.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

Thanks a lot for your help.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment