Wednesday, August 3, 2011

Problems with my first application

Hello GWT world, I'm a student who is trying to learn how to develop
with GWT framework. I already know well Java language but I'm stuck
with my first application: it's a simple log in interface which stores
user data into cookies, but I can't understand why it doesn't work
properly.

MainEntryPoint

private GWTLogInServiceAsync logInService =
GWT.create(GWTLogInService.class);
private GWTDeBugServiceAsync deBugService =
GWT.create(GWTDeBugService.class);
private String dataBaseString;
...
logInButton.addClickHandler(new ClickHandler() {

public void onClick(ClickEvent event) {
dataBaseString = null;

logInService.logIn(userNameTextBox.getText(),
passWordTextBox.getText(), new AsyncCallback<String>() {

@Override
public void onFailure(Throwable caught) {
Window.alert("Log in failed!");
}

@Override
public void onSuccess(String result) {
dataBaseString = result;
}
});

deBugService.outPut("2) DataBase: " +
dataBaseString, new AsyncCallback<Void>() {

public void onFailure(Throwable caught) {
}

public void onSuccess(Void result) {
}
});

if (dataBaseString != null) {
logIn(userNameTextBox.getText(),
dataBaseString);
}
}
});
...
private void logIn(String userName, String dataBase) {
Cookies.setCookie("userName", userName);
Cookies.setCookie("dataBase", dataBase);

Location.reload();
}

GWTLogInServiceImpl

public String logIn(String userName, String passWord) {
String dataBase = null;

try {
Class.forName("org.postgresql.Driver");

Connection connection =
DriverManager.getConnection("jdbc:postgresql://localhost:5432/User
DataBase", postGreSQLUserName, postGreSQLPassWord);

String query = "SELECT \"DataBase\" FROM \"User\" WHERE
\"Name\" = '" + userName + "' AND \"PassWord\" = '" + passWord + "'";

ResultSet resultSet =
connection.createStatement().executeQuery(query);

if (resultSet.next()) {
dataBase = resultSet.getString("DataBase");
}
} catch (Exception exception) {
exception.printStackTrace();
}

System.out.println("1) DataBase: " + dataBase);

return dataBase;
}

GWTDeBugServiceImpl

public void outPut(String string) {
System.out.println(string);
}

I get the following output:
2) DataBase: null
1) DataBase: dataBaseName

Why does it execute GWTDeBugService before GWTLogInService? I'm using
NetBeans 6.9.1 with the latest GWT framework and GWT4NB plugin.
In addition, during compilation I get the following errors:
Validating newly compiled units
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/com/google/gwt/editor/client/EditorDriver.java'
[ERROR] Line 20: The import
javax.validation.ConstraintViolation cannot be resolved
[ERROR] Line 97: ConstraintViolation cannot be resolved to a
type
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/com/google/gwt/editor/client/impl/
AbstractSimpleBeanEditorDriver.java'
[ERROR] Line 28: Name clash: The method
setConstraintViolations(Iterable<ConstraintViolation<?>>) of type
BaseEditorDriver<T,E> has the same erasure as
setConstraintViolations(Iterable<ConstraintViolation<?>>) of type
EditorDriver<T> but does not override it
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/com/google/gwt/editor/client/impl/BaseEditorDriver.java'
[ERROR] Line 31: The import
javax.validation.ConstraintViolation cannot be resolved
[ERROR] Line 67: ConstraintViolation cannot be resolved to a
type
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/com/google/gwt/editor/client/impl/SimpleViolation.java'
[ERROR] Line 25: The import
javax.validation.ConstraintViolation cannot be resolved
[ERROR] Line 40: ConstraintViolation cannot be resolved to a
type
[ERROR] Line 43: ConstraintViolation cannot be resolved to a
type
[ERROR] Line 44: Missing code implementation in the compiler
[ERROR] Line 49: ConstraintViolation cannot be resolved to a
type
[ERROR] Line 49: Missing code implementation in the compiler
[ERROR] Line 70: ConstraintViolation cannot be resolved to a
type
[ERROR] Line 72: ConstraintViolation cannot be resolved to a
type
[ERROR] Line 73: ConstraintViolation<?> cannot be resolved to
a type
[ERROR] Line 77: ConstraintViolation<capture#2-of ?> cannot
be resolved to a type
[ERROR] Line 81: ConstraintViolation<capture#3-of ?> cannot
be resolved to a type
[ERROR] Line 89: ConstraintViolation<capture#4-of ?> cannot
be resolved to a type
[ERROR] Line 93: ConstraintViolation<capture#5-of ?> cannot
be resolved to a type
[ERROR] Line 98: ConstraintViolation cannot be resolved to a
type
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/com/google/gwt/editor/client/testing/
MockSimpleBeanEditorDriver.java'
[ERROR] Line 26: The import
javax.validation.ConstraintViolation cannot be resolved
[ERROR] Line 35: The type MockSimpleBeanEditorDriver<T,E>
must implement the inherited abstract method
EditorDriver<T>.setConstraintViolations(Iterable<ConstraintViolation<?
>>)
[ERROR] Line 107: Name clash: The method
setConstraintViolations(Iterable<ConstraintViolation<?>>) of type
MockSimpleBeanEditorDriver<T,E> has the same erasure as
setConstraintViolations(Iterable<ConstraintViolation<?>>) of type
EditorDriver<T> but does not override it
[ERROR] Line 108: ConstraintViolation cannot be resolved to a
type
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/javax/validation/super/javax/validation/Configuration.java'
[ERROR] Line 93: TraversableResolver cannot be resolved to a
type
[ERROR] Line 105: ConstraintValidatorFactory cannot be
resolved to a type
[ERROR] Line 182: TraversableResolver cannot be resolved to a
type
[ERROR] Line 182: No source code is available for type
TraversableResolver; did you forget to inherit a required module?
[ERROR] Line 194: ConstraintValidatorFactory cannot be
resolved to a type
[ERROR] Line 194: No source code is available for type
ConstraintValidatorFactory; did you forget to inherit a required
module?
[ERROR] Line 202: ValidatorFactory cannot be resolved to a
type
[ERROR] Line 202: No source code is available for type
ValidatorFactory; did you forget to inherit a required module?
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/javax/validation/
ConstraintViolationException_CustomFieldSerializer.java'
[ERROR] Line 30: ConstraintViolationException cannot be
resolved to a type
[ERROR] Line 34: ConstraintViolationException cannot be
resolved to a type
[ERROR] Line 34: No source code is available for type
ConstraintViolationException; did you forget to inherit a required
module?
[ERROR] Line 39: ConstraintViolation cannot be resolved to a
type
[ERROR] Line 39: ConstraintViolation cannot be resolved to a
type
[ERROR] Line 40: ConstraintViolationException cannot be
resolved to a type
[ERROR] Line 44: ConstraintViolationException cannot be
resolved to a type
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/javax/validation/super/javax/validation/
MessageInterpolator.java'
[ERROR] Line 21: The import javax.validation.metadata cannot
be resolved
[ERROR] Line 66: ConstraintDescriptor cannot be resolved to a
type
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/javax/validation/super/javax/validation/constraints/
Pattern.java'
[ERROR] Line 30: The import javax.validation.Constraint
cannot be resolved
[ERROR] Line 31: The import javax.validation.Payload cannot
be resolved
[ERROR] Line 49: Constraint cannot be resolved to a type
[ERROR] Line 49: The attribute validatedBy is undefined for
the annotation type Constraint
[ERROR] Line 75: Payload cannot be resolved to a type
[ERROR] Errors in 'jar:file:/{projectFolder}/lib/GWT2.3.0/gwt-
user.jar!/javax/validation/super/javax/validation/spi/
ConfigurationState.java'
[ERROR] Line 22: The import
javax.validation.ConstraintValidatorFactory cannot be resolved
[ERROR] Line 24: The import
javax.validation.TraversableResolver cannot be resolved
[ERROR] Line 93: ConstraintValidatorFactory cannot be
resolved to a type
[ERROR] Line 107: TraversableResolver cannot be resolved to a
type
Computing all possible rebind results for
'com.google.gwt.user.client.UserAgentAsserter'
Rebinding com.google.gwt.user.client.UserAgentAsserter
Checking rule <generate-with
class='com.google.gwt.editor.rebind.SimpleBeanEditorDriverGenerator'/>
[WARN] Detected warnings related to
'com.google.gwt.editor.client.SimpleBeanEditorDriver'. Are
validation-api-<version>.jar and validation-api-<version>-sources.jar
on the classpath?
Specify -logLevel DEBUG to see all errors.
[WARN] Unknown type
'com.google.gwt.editor.client.SimpleBeanEditorDriver' specified in
deferred binding rule

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment