Note that there are some explanatory texts on larger screens.

plurals
  1. POException while running GWT application
    text
    copied!<p>I have built my first GWT app. giving no compilation errors neither run-time errors. However, when the application is loaded into the browser (using Interner Explorer) and I enter <strong>username</strong> and <strong>password</strong> field to validate the user, it throws exceptions. Using GWT-RPC method, entire code and interfaces are provided. I'm using <strong>HSQL</strong> for database connection(back end).</p> <p>------------------CODE (CLIENT)</p> <pre><code>package com.vin.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.PasswordTextBox; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; public class HelloWorld implements EntryPoint{ private UserServiceAsync UserService = (UserServiceAsync) GWT.create(UserService.class); public void onModuleLoad() { Button click=new Button("Click Here"); Label name=new Label("Enter Name"); Label passwrd=new Label("Enter Password"); final TextBox t_name=new TextBox(); final PasswordTextBox t_passwrd=new PasswordTextBox(); click.addClickHandler(new ClickHandler() { public void onClick(ClickEvent ev) { String temp_user=t_name.getText(); String temp_pass=t_passwrd.getText(); UserService.loginuser(temp_user, temp_pass, new AsyncCallback&lt;String&gt;() { public void onFailure(Throwable caught) { Window.alert("Please enter valid details"); } public void onSuccess(String result) { Window.alert("Welcome"); // Window.open("http://127.0.0.1:8888/ExWid.html?gwt.codesvr=127.0.0.1:9997", "Dem", null); } }); } }); RootPanel.get().add(name); RootPanel.get().add(t_name); RootPanel.get().add(passwrd); RootPanel.get().add(t_passwrd); RootPanel.get().add(click); } } </code></pre> <p>-----------------------------CLIENT INTERFACE (1)</p> <pre><code>package com.vin.client; import com.google.gwt.user.client.rpc.RemoteService; public interface UserService extends RemoteService { public String loginuser(String username, String password); } </code></pre> <p>----------------------------CLIENT ASYNC INTERFACE</p> <pre><code>package com.vin.client; import com.google.gwt.user.client.rpc.AsyncCallback; public interface UserServiceAsync { public void loginuser(String username, String password, AsyncCallback&lt;String&gt; callback); } </code></pre> <p>--------------------------IMPLEMENTATION OF CLIENT USERSERVICE (SERVER)...DATABASE CONNECTION</p> <pre><code>package com.vin.server; import java.sql.DriverManager; import java.sql.ResultSet; import com.google.gwt.dev.generator.ast.Statement; import com.google.gwt.user.client.Window; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.vin.client.UserService; public class UserServiceImpl extends RemoteServiceServlet implements UserService{ private static final long serialVersionUID = 1L; public String loginuser(String username,String password) { try { java.sql.Connection con = null; Class.forName("org.hsqldb.jdbcDriver"); con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/", "SA", ""); Statement st=(Statement) con.createStatement(); ResultSet rs=((java.sql.Statement) st).executeQuery("select username,password from lgfrm"); String user=rs.getString(1); String pass=rs.getString(2); if(username.equals(user) &amp;&amp; password.equals(pass)) { Window.alert("success"); } } catch (Exception ae) {} return "success"; } } </code></pre> <p>------------------THE EXCEPTION LIST WHILE I'M TRYING TO VALIDATE A USER</p> <blockquote> <p>15:22:54.583 [ERROR] [helloworld] Uncaught exception escaped com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129) at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129) at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116) at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351) </p> </blockquote> <p>And many more like these.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload