Hi All,
I am new to GWT. I am getting problem in calling the RPC methods. before I
had problem with entity not mapped, it solved now but getting new problem
that not returning any valued from *getOneByLoginAndPassword* method.. I get
value from database but not *LoginImpl*..
gettting following error and source code given as well
[WARN] StandardContext[]Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public
abstract java.lang.String
com.mycompany.client.gwtinterfaces.Login.login(java.lang.String,java.lang.String)'
threw an unexpected exception: java.lang.NullPointerException
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:289)
........
<..skip ..>
......
Caused by: java.lang.NullPointerException: null
at com.mycompany.server.LoginImpl.login(LoginImpl.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:289)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
source Code is as follows..
*1.*
*public class LoginImpl extends RemoteServiceServlet implements Login {*
*public String login(String user, String password) {*
System.out.println(" user"+user+" pass;"+password);
* UserLogin userLogin = new
UserLoginsDb().getOneByLoginAndPassword(user, password)*;
System.out.println("User is:" +userLogin.login); * // Not getting
any thing gives error*
*}*
*}*
*2.*
*public class UserLoginsDb extends GenericDbOperations<UserLogin> {*
public UserLogin *getOneByLoginAndPassword(String login, String
password)* {
try {
* return new
NativeSqlQueryExecutor<UserLogin>().executeSqlOneRow(
"select * from userlogin where login=:login and
cryptedpassword=:password and isactive=1",
new String[]{"login","password"},
new Object[]{login,password});*
}
catch (TooManyRowsException e) {
// TODO Auto-generated catch block
LogMain.error(e.getMessage());
return null;
}
}
*}*
*
3.
public T executeSqlOneRow( String sql, String[] paramNames,
Object[] paramValues) throws TooManyRowsException {*
* List<T> l=executeSql(sql,paramNames,paramValues);*
if (l.size()==0) return null;
// if (l.size()>1) throw new TooManyRowsException();
System.out.println("excuteSQL one row" +l.get(0)); * // I am
getting object output here*
System.out.println("excuteSQL one row" +l.size()); * // I am
getting object output here*
return l.get(0);
*}*
*4.*
@SuppressWarnings("unchecked") *public List<T> executeSql(String sql,
String[] paramNames,
Object[] paramValues) {*
Session sess = null;
try {
sess = HibernateUtil.getSessionWithTransaction();
Query query = sess.createSQLQuery(sql);
if (paramNames != null) {
for (int i = 0; i < paramNames.length; i++) {
query.setParameter(paramNames[i], paramValues[i]);
}
}
List<T> list = (List<T>) query.list(); // here hibernate
executes the query
sess.close();
return list;
}
finally {
if (sess != null) {
if (sess.isOpen())
if (sess.getTransaction() != null)
sess.getTransaction().rollback();
}
}
* }*
Can anybody please tell where is the problem. Really don't understand why..
if anything more needed please let me know..
thx in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---