What is wrong with my code (GWT) - java

I'm creating a login application on Eclipse using Google Web Toolkit(GWT). The code checks for the username and password and if its correct, it shows the o/p as welcome. Still after compiling it is giving me errors.I'm sharing both code and the error message. Please help me out.
package com.vin.client;
import java.sql.DriverManager;
import java.sql.ResultSet;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dev.generator.ast.Statement;
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.ui.*;
public class HelloWorld implements EntryPoint{
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 TextBox t_passwrd=new TextBox();
click.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent ev) {
try {
String temp_user=t_name.getText();
String temp_pass=t_passwrd.getText();
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(temp_user.equals(user) && temp_pass.equals(pass)) {
Window.alert("Welcome");
}
else {
Window.alert("Please enter valid details");
}
}
catch (Exception ae) {}
}
});
RootPanel.get().add(name);
RootPanel.get().add(t_name);
RootPanel.get().add(passwrd);
RootPanel.get().add(t_passwrd);
RootPanel.get().add(click);
}
}
Error Message is----------
Compiling module com.vin.HelloWorld Exception in thread
"UnitCacheLoader" java.lang.RuntimeException: Unable to read from byte
cache at
com.google.gwt.dev.util.DiskCache.transferFromStream(DiskCache.java:166)
at
com.google.gwt.dev.util.DiskCacheToken.readObject(DiskCacheToken.java:87)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
..............and many more like this....Please help me out

Try something like following for Server side :
UserService.java
#RemoteServiceRelativePath("userService")
public interface UserService extends RemoteService {
String loginUser(String username,String password);
}
UserServiceAsync.java
public interface UserServiceAsync {
void loginUser(String username, String password, AsyncCallback<String> callback);
}
UserServiceImpl.java
public class UserServiceImpl extends RemoteServiceServlet implements UserService {
public String loginUser(String username, String password){
//database interaction
return "result"; //return success or failure depending upon logic
}
}
Follow Communicate with a Server in GWT and the Anatomy of service
For Client Side :
public class HelloWorld implements EntryPoint{
//(1) Create the client proxy.
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 TextBox t_passwrd=new TextBox();
click.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent ev) {
String temp_user=t_name.getText();
String temp_pass=t_passwrd.getText();
/// (2) Create an asynchronous callback and Make the call
userService.loginUser(temp_user, temp_pass, new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
Window.alert("Please enter valid details");
}
public void onSuccess(String result) {
Window.alert("Welcome");
}
});//end of service call
});//end of clickhandler
RootPanel.get().add(name);
RootPanel.get().add(t_name);
RootPanel.get().add(passwrd);
RootPanel.get().add(t_passwrd);
RootPanel.get().add(click);
}
}

You can not put DB related code in Entry point class, you need to call GWT-RPC on click method.
Actually this EntryPoint class would be compiled by GWT processor and it will create javascript in output which going to run in browser. So there is no justification you can call db in javascript.
GWT-RPC is asynchronous call which code reside in server. Here you can write all business logic, db interactivity etc.
LINK

Related

How to store and retrieve database information based on logged in user in Java, using swing GUI (Netbeans)

I'm pretty new to Java. I'm using Swing and Netbeans on MySQL DB. I am working on a desktop application that allows users to make orders for products. The user have to sign in to order. How do I save the order information for each user after they have logged in. My login code is as shown.
Database connection (dbconnect.java)
package dbconnect;
import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
/**
*
* #author Nipun Senarath
*/
public class dbconnect {
public static Connection connect()
{
Connection sos = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
sos = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurant","root","");
} catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
return sos;
}
public static Connection Connect() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
The login page
PatronLogin.java
package patron.auth;
import dbconnect.dbconnect;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import patron.main.MainClass;
public class PatronLogin extends javax.swing.JFrame {
public PatronLogin() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: Login button
String uname = jTextField1.getText();
String pword = jPasswordField1.getText();
if (uname.equals("")||pword.equals("")) {
JOptionPane.showMessageDialog(rootPane, "Some fields are empty", "Error", 1);
} else {
try {
Connection con = dbconnect.connect();
PreparedStatement pst = con.prepareStatement("select * from patron where username=? and password=?");
pst.setString(1, uname);
pst.setString(2, pword);
ResultSet rs = pst.executeQuery();
if (rs.next()) {
MainClass pt = new MainClass();
pt.setVisible(true);
dispose();
} else {
JOptionPane.showMessageDialog(rootPane, "Username or Password do not match record", "Login error", 1);
}
} catch (Exception ex) {
System.out.println(""+ex);
}
}
}
public static void main(String args[]) {
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
PatronLogin ln = new PatronLogin();
ln.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
ln.setVisible(true);
}
});
}
Then the user account page
package patron.main;
import patron.event.EventMenuSelected;
import patron.form.Form_1;
import patron.form.Form_4;
import patron.form.Form_3;
import patron.form.Form_2;
import patron.form.Form_Home;
import java.awt.Color;
import javax.swing.JComponent;
public class MainClass extends javax.swing.JFrame {
/**
* Creates new form MainClass
*/
private Form_Home home;
private Form_1 form1;
private Form_2 form2;
public static Form_3 form3;
private Form_4 form4;
public MainClass() {
initComponents();
setBackground(new Color(0, 0, 0, 0));
home = new Form_Home();
form1 = new Form_1();
form2 = new Form_2();
form3 = new Form_3();
form4 = new Form_4();
menu.initMoving(MainClass.this);
menu.addEventMenuSelected(new EventMenuSelected() {
#Override
public void selected(int index) {
if (index == 0) {
setForm(home);
} else if (index == 1) {
setForm(form1);
} else if (index == 2) {
setForm(form2);
} else if (index == 3) {
setForm(form3);
} else if (index == 4) {
setForm(form4);
}
}
});
// set when system open start with home form
setForm(new Form_Home());
}
public void setForm(JComponent com) {
mainPanel.removeAll();
mainPanel.add(com);
mainPanel.repaint();
mainPanel.revalidate();
}
public static void main(String args[]) {
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainClass().setVisible(true);
}
});
}
I want to insert an order into the order table with order_id, item, price, and patron_id for the logged in user, so I can be able to retieve it in another table showing the particular user's order history, how do I achieve that. Same goes for other patrons...
There's a lot of work to do, but you can "offload" a lot of that. ;-)
If your desktop-application is a "single-user" application you can create a "Singleton" object to store the current logged user.
That object will represent a "Session", that will be built after a successful login and it will contain the logged user (aka Principal).
There'are various points where you can improve:
security: password are stored in plain text, it would be better to use an hash function for that -- https://www.baeldung.com/java-password-hashing
logic and db code in UI: mixing all the code together will make it very harder to handle it and fix it (believe me). Again, following an Object-Oriented approach is better to model with something like:
interface Products {
List<Product> listAll();
}
interface Orders {
void save(Order order)
}
The implementation of that interfaces will interact with the db, returning the data to the UI and doing the actions started from the user.
db connections handling: obtaining a db connection takes a lot of time, for this reason exists Connection Pools see - https://github.com/brettwooldridge/HikariCP
db interaction way: instead of plain jdbc you're using see -- https://www.marcobehler.com/guides/java-databases
TIPS: Nebeans historically could create interface that interact with standard DB interaction ways (ie JPA) -- https://netbeans.apache.org/tutorials/74/nbm-crud.html

How to make a login using a database in intellij idea

so I'm very new to javafx in intellij idea, i have a problem where I have connected with mySQl database in the database section, but now i can't find anywhere how to select everything from my database without having to use a connection string (because i am already connected with the database)
I have already tried several things like just leaving the connection string out but that wouldn't work, I have searched for the answer for a long time now and can't find it anywhere, I hope someone can help me with this.
package sample;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.*;
public class logincontroller extends Application {
public TextField txtusername;
public PasswordField txtpassword;
public Label labeltxt;
public Button btnLogin;
String username, password;
Scene scene1;
public static void main(String[] args) {
launch(args);
}
#Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Login.fxml"));
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
public void Login(ActionEvent actionEvent) throws IOException, SQLException {
username = txtusername.getText();
password = txtpassword.getText();
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String sql;
sql = "SELECT * FROM users WHERE Inlognaam = 1 AND Wachtwoord = 2";
preparedStatement.setString(1, username);
preparedStatement.setString(2, password);
resultSet = preparedStatement.executeQuery(sql);
if (!resultSet.next()) {
labeltxt.setText("Login Failed");
} else {
Parent root1 = FXMLLoader.load(getClass().getResource("Menu.fxml"));
Stage secondarystage = new Stage();
secondarystage.setScene(new Scene(root1));
secondarystage.show();
Stage stage = (Stage) btnLogin.getScene().getWindow();
stage.close();
}
txtusername.setText("");
txtpassword.setText("");
}
}
this is what i already have at this moment
In Response to #GhostCat This should help you get started. Make sure however that after using the Connection you close it. Same with PreparedStatments always close them if youre not using them.
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connector {
public Connection con;
private final String URL = "jdbc:mysql://localhost:3306/dbname";
private final String USERNAME = "username";
private final String PASSWORD = "password";
/*
* Adds DB Connection
*/
public void add() {
try {
con = DriverManager.getConnection(URL, USERNAME, PASSWORD);
} catch (SQLException se) {
se.printStackTrace();
}
}
}```
You don't want to leave your connection open. You want to connect, select, then close. Please research "Try with Resources" for how to do this properly.
Typically a web server handles sessions so please forgive me for this answer.
What you can do is add a token, ID, secret code, to your Users table that gets sent back to the client. Then in the next controller after your secondary stage loads, you need to do a second connection to the database and a new sql query using the secret code for that user. This way, your database can only return records intended for that specific user.

Sending messages in GWT by Errai framework

here you can see how to send a message from client.
I have a client HelloServer.java, when i click on the button I want to send message to a server.
package gwt.user.client;
import org.jboss.errai.bus.client.ErraiBus;
import org.jboss.errai.bus.client.api.base.CommandMessage;
import org.jboss.errai.bus.client.api.base.MessageBuilder;
import org.jboss.errai.bus.client.api.messaging.Message;
import org.jboss.errai.bus.client.api.messaging.MessageBus;
import org.jboss.errai.bus.client.api.messaging.MessageCallback;
import org.jboss.errai.bus.client.api.messaging.RequestDispatcher;
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.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
public class HelloServer implements EntryPoint{
private MyTable table;
private MessageBus bus = ErraiBus.get();
private RequestDispatcher dispatcher = ErraiBus.getDispatcher();
UserService usrSer;
private RequestDispatcher getDispatcher(){
return this.dispatcher;
}
public void onModuleLoad() {
table = new MyTable(null);
Button button = new Button("Click me");
// We can add style names
button.addStyleName("pc-template-btn");
// or we can set an id on a specific element for styling
VerticalPanel vPanel = new VerticalPanel();
vPanel.setWidth("100%");
vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
vPanel.add(button);
vPanel.add(table);
// add table and button to the RootPanel
RootPanel.get().add(vPanel);
// create the dialog box
final DialogBox dialogBox = new DialogBox();
dialogBox.setText("Welcome to GWT Server Communication!");
dialogBox.setAnimationEnabled(true);
Button closeButton = new Button("close");
VerticalPanel dialogVPanel = new VerticalPanel();
dialogVPanel.setWidth("100%");
dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
dialogVPanel.add(closeButton);
closeButton.addClickHandler(new ClickHandler() {
#Override
public void onClick(ClickEvent event) {
dialogBox.hide();
}
});
// Set the contents of the Widget
dialogBox.setWidget(dialogVPanel);
button.addClickHandler(new ClickHandler() {
#Override
public void onClick(ClickEvent event) {
UserServiceAsync service = (UserServiceAsync) GWT.create(UserService.class);
ServiceDefTarget serviceDef = (ServiceDefTarget) service;
serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "userService");
UserCallback myUserCallback = new UserCallback(table);
MessageBuilder.createMessage()
.toSubject("UserServiceImpl") // (1)
.signalling() // (2)
.noErrorHandling() // (3)
.sendNowWith(getDispatcher()); // (4)
service.getUserList(myUserCallback);
}
});
}
}
UserServiceImpl.java is the server where I want to receive the message in callback method.
package gwt.user.server;
import gwt.user.client.User;
import gwt.user.client.UserService;
import java.util.ArrayList;
import java.util.List;
import org.jboss.errai.bus.client.api.base.CommandMessage;
import org.jboss.errai.bus.client.api.messaging.Message;
import org.jboss.errai.bus.client.api.messaging.MessageCallback;
import org.jboss.errai.bus.server.annotations.Service;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
#Service
public class UserServiceImpl extends RemoteServiceServlet implements UserService, MessageCallback {
private static final long serialVersionUID = 1L;
private List<User> userList = new ArrayList<User>();
public UserServiceImpl() {
User user = new User();
user.setId("1");
user.setUsername("Peter");
user.setNumberOfHits("15");
userList.add(user);
user = new User();
user.setId("2");
user.setUsername("Hanz");
user.setNumberOfHits("25");
userList.add(user);
}
public User getUser(String id) {
for (Object object : userList) {
if (((User) object).getId().equals(id))
return ((User) object);
}
return null;
}
public List<User> getUserList() {
return userList;
}
#Override
public void callback(Message message) {
System.out.print("Message received");
}
public void callback(CommandMessage message) {
System.out.print("Message received");
}
}
When I click the button I get no subscribers to deliver error message:
org.jboss.errai.bus.client.api.base.NoSubscribersToDeliverTo: no subscribers to deliver to for subject: UserServiceImpl
org.jboss.errai.bus.client.framework.ClientMessageBusImpl.send(ClientMessageBusImpl.java:812)
org.jboss.errai.bus.client.ErraiBus$3.dispatch(ErraiBus.java:171)
org.jboss.errai.bus.client.api.base.CommandMessage.sendNowWith(CommandMessage.java:349)
org.jboss.errai.bus.client.api.base.DefaultMessageBuilder$1.sendNowWith(DefaultMessageBuilder.java:95)
gwt.user.client.HelloServer$2.onClick(HelloServer.java:84)
If I annotate UserServiceImpl.java class with #Service("UserServiceImpl"), it doesn't help and I get the same error.
When I add
bus.subscribe("UserServiceImpl", new UserServiceImpl());
before MessageBuilder.createMessage() in HelloServer.java
I get error message
[ERROR] No source code is available for type gwt.user.server.UserServiceImpl; did you forget to inherit a required module?
Does anybody know how to use messaging between Client and Server in GWT applications or show me a basic example?
Answer is in this thread. I forgot to add ErraiApp.properties file.

Asterisk + asterisk-java listen new channels

Asterisk 11.4.0
Asterisk-java: 1.0.0.CI-SNAPSHOT
I've try to run this code:
import org.asteriskjava.live.AsteriskChannel;
import org.asteriskjava.live.AsteriskQueue;
import org.asteriskjava.live.AsteriskQueueEntry;
import org.asteriskjava.live.internal.AsteriskAgentImpl;
import org.asteriskjava.live.AsteriskServer;
import org.asteriskjava.live.AsteriskServerListener;
import org.asteriskjava.live.DefaultAsteriskServer;
import org.asteriskjava.live.ManagerCommunicationException;
import org.asteriskjava.live.MeetMeRoom;
import org.asteriskjava.live.MeetMeUser;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
public class HelloLiveEverything implements AsteriskServerListener, PropertyChangeListener
{
private AsteriskServer asteriskServer;
public HelloLiveEverything()
{
asteriskServer = new DefaultAsteriskServer("localhost", "manager", "password");
}
public void run() throws ManagerCommunicationException
{
// listen for new events
asteriskServer.addAsteriskServerListener(this);
// add property change listeners to existing objects
for (AsteriskChannel asteriskChannel : asteriskServer.getChannels())
{
System.out.println(asteriskChannel);
asteriskChannel.addPropertyChangeListener(this);
}
}
public void onNewAsteriskChannel(AsteriskChannel channel)
{
System.out.println(channel);
channel.addPropertyChangeListener(this);
}
public void onNewMeetMeUser(MeetMeUser user)
{
System.out.println(user);
user.addPropertyChangeListener(this);
}
public void onNewQueueEntry(AsteriskQueueEntry user)
{
System.out.println(user);
user.addPropertyChangeListener(this);
}
public void onNewAgent(AsteriskAgentImpl user)
{
System.out.println(user);
user.addPropertyChangeListener(this);
}
public void propertyChange(PropertyChangeEvent propertyChangeEvent)
{
System.out.println(propertyChangeEvent);
}
public static void main(String[] args) throws Exception
{
HelloLiveEverything helloLiveEverything = new HelloLiveEverything();
helloLiveEverything.run();
while (true) {
}
}
}
When executed, connectios is OK. This code show me current channels but never show me new channels when callers make a calls.
I need to catch the events when new asterisk channels are opening.
What I made wrong?
Thank you
Try This:
Your Class HelloLiveEverything should implement ManagerEventListener
then override the onManagerEvent method
#Override
public void onManagerEvent(ManagerEvent event) {
String event_name = event.getClass().getSimpleName();
if (event_name.equals("DialEvent")) {
DialEvent e = (DialEvent) event;
System.out.println(e.getCallerIdNum());//caller number
System.out.println(e.getDestination());//Called number
//do something here
}
}
edit asterisk manager.conf :
[manager]
secret = password
deny=0.0.0.0/0.0.0.0
permit=209.16.236.73/255.255.255.0; change this ip with one your java app is using permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,originate; add full permission
write = system,call,log,verbose,command,agent,user,originate; add full permission

Exception while running GWT application

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 username and password field to validate the user, it throws exceptions. Using GWT-RPC method, entire code and interfaces are provided.
I'm using HSQL for database connection(back end).
------------------CODE (CLIENT)
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<String>() {
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);
}
}
-----------------------------CLIENT INTERFACE (1)
package com.vin.client;
import com.google.gwt.user.client.rpc.RemoteService;
public interface UserService extends RemoteService {
public String loginuser(String username, String password);
}
----------------------------CLIENT ASYNC INTERFACE
package com.vin.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface UserServiceAsync {
public void loginuser(String username, String password, AsyncCallback<String> callback);
}
--------------------------IMPLEMENTATION OF CLIENT USERSERVICE (SERVER)...DATABASE CONNECTION
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) && password.equals(pass)) {
Window.alert("success");
}
}
catch (Exception ae) {}
return "success";
}
}
------------------THE EXCEPTION LIST WHILE I'M TRYING TO VALIDATE A USER
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)
And many more like these.
com.google.gwt.user.client.Window class provides access to the browser window's methods, properties, and events. So you can't use it in Serverside. Better you return String "success" when requirement meets, else return Exception, so that it is caught by onFailure on clientside.
I think you can't use Window.alert on server side (in UserServiceImpl class). There can be many clients and server can't know about what client it directed for.
But i'm not sure that it causes this error.

Categories

Resources