Hi,
I am using SmartGWTPower 2.3 with SmartClient 7.0 Power Edition. I am trying to create a simple login procedure and eventually I would like to call a custom operation on the server for user authentication. The problem is when I call fetchData against my data source with any arguments I get a null pointer exception. If I call a pure fetchData with no arguments I get no error. I'm not getting much from the console to point me in the right direction. Here is what I am doing:
Client code:
war/shared/ds/users.ds.xml
When I click on the login button I get
and the console gives me
It seems such a simple thing, any ideas where I could be going wrong?
Thanks,
Justin
I am using SmartGWTPower 2.3 with SmartClient 7.0 Power Edition. I am trying to create a simple login procedure and eventually I would like to call a custom operation on the server for user authentication. The problem is when I call fetchData against my data source with any arguments I get a null pointer exception. If I call a pure fetchData with no arguments I get no error. I'm not getting much from the console to point me in the right direction. Here is what I am doing:
Client code:
Code:
package t1.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.PasswordItem; import com.smartgwt.client.widgets.form.fields.TextItem; public class login implements EntryPoint { @Override public void onModuleLoad() { final Window winModal = new Window(); winModal.setWidth(360); winModal.setHeight(115); winModal.setTitle("SmartClient Login"); winModal.setShowMinimizeButton(false); winModal.setIsModal(true); winModal.setShowModalMask(true); winModal.centerInPage(); DynamicForm form = new DynamicForm(); form.setHeight100(); form.setWidth100(); form.setPadding(5); form.setLayoutAlign(VerticalAlignment.BOTTOM); final TextItem userName = new TextItem(); final PasswordItem password = new PasswordItem(); userName.setTitle("Username"); password.setTitle("Password"); IButton blogin = new IButton("Login"); blogin.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { DataSource ds = new DataSource(); ds = DataSource.get("users"); Criteria userdata = new Criteria(); userdata.addCriteria("username", userName.getValue().toString()); userdata.addCriteria("password", password.getValue().toString()); ds.fetchData(userdata); } }); form.setFields(userName, password); winModal.addItem(form); winModal.addItem(blogin); winModal.show(); } }
Code:
<DataSource ID="users" serverType="sql" tableName="users"> <fields> <field name="userid" type="sequence" title="Patid" hidden="true" primaryKey="true"/> <field name="username" type="text" length="32" title="Firstname"/> <field name="password" type="text" length="32" title="Lastname"/> <field name="firstname" type="text" length="32" title="Address1"/> </fields> <!-- I have the custom operation commented out until I get my exception solved so this is just a vanilla data source <operationBindings> <binding operationId="login" operationType="fetch" serverMethod="fetchlogin"> <serverObject lookupStyle="new" className="t1.server.login"/> </binding> </operationBindings> --> <dataSourceVersion>1</dataSourceVersion> <generatedBy>7.0rc2/SDK Development Only 2009-05-30</generatedBy> </DataSource>
Code:
"Uncaught exception escaped : com.google.gwt.core.client.JavaScriptException (null): null See the Development console log for details. Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling."
Code:
14:17:29.076 [ERROR] [t1] Uncaught exception escaped com.google.gwt.core.client.JavaScriptException: (null): null at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.data.DataSource.fetchData(DataSource.java) at t1.client.login$1.onClick(login.java:48) at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:96) at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53) at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178) at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) 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:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1714) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264) 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:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) 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:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1669) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222) at java.lang.Thread.run(Thread.java:636)
Thanks,
Justin
Comment