I'm building a login application.I'm getting Umbrella Exception everytime, after clicking the Button....unable to find the root cause. Im providing the code and the error list. Please provide me with the fix. Using GWT-RPC
CLIENT SIDE 1. VinLog.java
package com.login.vinayak.client;
import com.google.gwt.core.client.EntryPoint;
public class VinLog implements EntryPoint {
private GreetingServiceAsync GreetingService = (GreetingServiceAsync) GWT.create(GreetingService.class);
public void onModuleLoad() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
Window.alert("uncaught: " +e.getMessage());
Window.alert("uncaught: " + e.getMessage());
String s = buildStackTrace(e, "RuntimeExceotion:\n");
Window.alert(s);
e.printStackTrace();
System.out.println(e.getCause());
}
});
RootPanel rootPanel = RootPanel.get();
SimplePanel simplePanel = new SimplePanel();
rootPanel.add(simplePanel, 0, 0);
simplePanel.setSize("450px", "19px");
Label lblLoginForm = new Label("LOGIN");
lblLoginForm.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
simplePanel.setWidget(lblLoginForm);
lblLoginForm.setSize("544px", "41px");
Label lblUserName = new Label("User Name");
rootPanel.add(lblUserName, 10, 124);
Label lblPassword = new Label("Password");
rootPanel.add(lblPassword, 10, 183);
final TextBox textBox = new TextBox();
textBox.setAlignment(TextAlignment.CENTER);
rootPanel.add(textBox, 112, 114);
textBox.setSize("139px", "18px");
final PasswordTextBox passwordTextBox = new PasswordTextBox();
rootPanel.add(passwordTextBox, 112, 173);
passwordTextBox.setSize("139px", "18px");
Button btnClickToEnter = new Button("Click to Enter");
btnClickToEnter.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
String j=textBox.getText();
String k=passwordTextBox.getText();
GreetingService.loginuser(j, k, new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
Window.alert("welcome");
}
public void onSuccess(String result) {
Window.alert("try again");
}
});
}
});
rootPanel.add(btnClickToEnter, 10, 229);
final ListBox comboBox = new ListBox();
comboBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
Object ob=comboBox.getElement();
if(ob=="Guest") {
Window.alert("Username and Passowrd is: Guest007");
}
}
});
comboBox.addItem("User");
comboBox.addItem("Admin");
comboBox.addItem("Guest");
rootPanel.add(comboBox, 10, 51);
comboBox.setSize("85px", "22px");
Image image = new Image("home.gif");
rootPanel.add(image, 310, 98);
image.setSize("182px", "155px");
}
protected String buildStackTrace(Throwable t, String log) {
if (t != null) {
log += t.getClass().toString();
log += t.getMessage();
StackTraceElement[] stackTrace = t.getStackTrace();
if (stackTrace != null) {
StringBuffer trace = new StringBuffer();
for (int i = 0; i < stackTrace.length; i++) {
trace.append(stackTrace[i].getClassName() + "." + stackTrace[i].getMethodName() + "("
+ stackTrace[i].getFileName() + ":" + stackTrace[i].getLineNumber());
}
log += trace.toString();
}
Throwable cause = t.getCause();
if (cause != null && cause != t) {
log += buildStackTrace(cause, "CausedBy:\n");
}
}
return log;
}
}
2.GreetingService.java
package com.login.vinayak.client;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@SuppressWarnings("unused")
public interface GreetingService extends RemoteService {
public String loginuser(String username, String password);
}
3.GreetinServiceAsync.java
package com.login.vinayak.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface GreetingServiceAsync {
public void loginuser(String username, String password, AsyncCallback<String> callback);
}
SERVER SIDE ==> GreetingServiceImpl.java
package com.login.vinayak.server;
import com.login.vinayak.client.GreetingService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import java.sql.DriverManager;
import java.sql.ResultSet;
import com.google.gwt.dev.generator.ast.Statement;
public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService{
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);
boolean b1=username.equals(user);
boolean b2= password.equals(pass);
if(b1==b2==true) {
return "success";
}
}
catch (Exception ae) {}
return "Success";
}
}
web.xml
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
> <web-app> <servlet>
> <servlet-name>GreetingServiceImpl</servlet-name>
> <servlet-class>com.login.vinayak.server.GreetingServiceImpl</servlet-class>
> </servlet> <servlet-mapping>
> <servlet-name>GreetingServiceImpl</servlet-name>
> <url-pattern>/Login</url-pattern> </servlet-mapping> <!-- Default page to serve --> <welcome-file-list>
> <welcome-file>VinLog.html</welcome-file> </welcome-file-list>
>
> </web-app>
ERROR LIST
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) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307) at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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.GeneratedMethodAccessor31.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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)
**********ADDITIONAL ERROR-CAUSE LIST**********
Caused by: com.google.gwt.user.client.rpc.ServiceDefTarget$NoServiceEntryPointSpecifiedException: Service implementation URL not specified at com.google.gwt.user.client.rpc.impl.RemoteServiceProxy.doPrepareRequestBuilderImpl(RemoteServiceProxy.java:430) at com.google.gwt.user.client.rpc.impl.RemoteServiceProxy.doInvoke(RemoteServiceProxy.java:368) at com.google.gwt.user.client.rpc.impl.RemoteServiceProxy$ServiceHelper.finish(RemoteServiceProxy.java:74) at com.login.vinayak.client.GreetingService_Proxy.loginuser(GreetingService_Proxy.java:34) at com.login.vinayak.client.VinLog$2.onClick(VinLog.java:82) at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54) at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1) at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1) at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40) at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193) at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88) at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
KINDLY PROVIDE ME WITH THE FIX...TY
GWT.UncaughtExceptionHandler
to look at thegetCauses()
programmatically? – Thomas BroyerSystem.out.println( e.getCauses() )
in the handler and post the result for us? – Anders R. Bystrup