Balaji Chopparapu
8 Sep 2009, 1:01 AM
Hi,
I am trying to use JSON to display the set of records in a grid . But I am facing problem with “com.extjs.gxt.ui.client.data.JsonReader”. It is giving me the below exception.
java.lang.NullPointerException
at com.extjs.gxt.ui.client.data.JsonReader.read(JsonReader.java:55)
at com.extjs.gxt.ui.client.data.HttpProxy$1.onResponseReceived(HttpProxy.java:76)
at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:264)
at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:236)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:227)
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.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:140)
JSON Data:
{
"osim.getOSIMImagesResponse":
{
"item":[
{"batchFile":"Winxp.bat","codePage":"1252 - Western European","comment":"This is comment for Winxp","name":"WinXPImage 0","OS":"Winxp 0","SDPackName":"SDPackName","type":"WINXXP"},
{"batchFile":"Winxp.bat","codePage":"1252 - Western European","comment":"This is comment for Winxp","name":"WinXPImage 1","OS":"Winxp 1","SDPackName":"SDPackName","type":"WINXXP"}
]
}
}
My UI Class:
// defines the json structure
ModelType type = new ModelType();
type.setRoot("item");
type.addField("name", "name");
type.addField("batchFile", "batchFile");
type.addField("OS", "OS");
type.addField("codePage", "codePage");
type.addField("comment", "comment");
type.addField("SDPackName", "SDPackName");
type.addField("type", "type");
// use a http proxy to get the data
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,"http://localhost:9001/OSIMJSONService/osimimages" );
HttpProxy<String> proxy = new HttpProxy<String>(builder);
// need a loader, proxy, and reader
JsonLoadResultReader<ListLoadResult<ModelData>> reader = new JsonLoadResultReader<ListLoadResult<ModelData>>(type);
final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(
proxy, reader);
I believe there is something wrong in Model Type. Please Suggest
Thanks & Regards
Balaji Chopparapu
I am trying to use JSON to display the set of records in a grid . But I am facing problem with “com.extjs.gxt.ui.client.data.JsonReader”. It is giving me the below exception.
java.lang.NullPointerException
at com.extjs.gxt.ui.client.data.JsonReader.read(JsonReader.java:55)
at com.extjs.gxt.ui.client.data.HttpProxy$1.onResponseReceived(HttpProxy.java:76)
at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:264)
at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:236)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:227)
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.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:140)
JSON Data:
{
"osim.getOSIMImagesResponse":
{
"item":[
{"batchFile":"Winxp.bat","codePage":"1252 - Western European","comment":"This is comment for Winxp","name":"WinXPImage 0","OS":"Winxp 0","SDPackName":"SDPackName","type":"WINXXP"},
{"batchFile":"Winxp.bat","codePage":"1252 - Western European","comment":"This is comment for Winxp","name":"WinXPImage 1","OS":"Winxp 1","SDPackName":"SDPackName","type":"WINXXP"}
]
}
}
My UI Class:
// defines the json structure
ModelType type = new ModelType();
type.setRoot("item");
type.addField("name", "name");
type.addField("batchFile", "batchFile");
type.addField("OS", "OS");
type.addField("codePage", "codePage");
type.addField("comment", "comment");
type.addField("SDPackName", "SDPackName");
type.addField("type", "type");
// use a http proxy to get the data
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,"http://localhost:9001/OSIMJSONService/osimimages" );
HttpProxy<String> proxy = new HttpProxy<String>(builder);
// need a loader, proxy, and reader
JsonLoadResultReader<ListLoadResult<ModelData>> reader = new JsonLoadResultReader<ListLoadResult<ModelData>>(type);
final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(
proxy, reader);
I believe there is something wrong in Model Type. Please Suggest
Thanks & Regards
Balaji Chopparapu