java - netbeans glassfish nullpointer server error -


package servlet;  import manager.usermanager; import model.user; import java.io.ioexception; import java.io.printwriter; import javax.servlet.requestdispatcher; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import utils.iconstants; import utils.stringutils;  public class loginservlet extends httpservlet {      /**      * processes requests both http <code>get</code> ,         <code>post</code>  * methods.  *  * @param request servlet request  * @param response servlet response  * @throws servletexception if servlet-specific error occurs  * @throws ioexception if i/o error occurs  */ protected void processrequest(httpservletrequest request, httpservletresponse response)         throws servletexception, ioexception {string email = request.getparameter("email");     string password = request.getparameter("password");      if (stringutils.isstringempty(email) || stringutils.isstringempty(password)) {          requestdispatcher rd = request.getrequestdispatcher("/index.html");         rd.forward(request, response);      } else {          usermanager umgr = new usermanager();         user user = umgr.loginuser(email, password);         if (user == null) {             requestdispatcher rd = request.getrequestdispatcher("/index.html");             rd.forward(request, response);         } else {             request.getsession(true).setattribute(iconstants.session_key_user, user);             if (user.getusertype().equals(iconstants.user_type_admin)) {                 requestdispatcher rd = request.getrequestdispatcher("/adminhome.jsp");                 rd.forward(request, response);             } else if (user.getusertype().equals(iconstants.user_type_general_user)) {                 requestdispatcher rd = request.getrequestdispatcher("/genuserhome.jsp");                 rd.forward(request, response);             } else {                 requestdispatcher rd = request.getrequestdispatcher("/index.html");                 rd.forward(request, response);             }         }     }  }  // <editor-fold defaultstate="collapsed" desc="httpservlet methods. click on + sign on left edit code."> /**  * handles http <code>get</code> method.  *  * @param request servlet request  * @param response servlet response  * @throws servletexception if servlet-specific error occurs  * @throws ioexception if i/o error occurs  */ @override protected void doget(httpservletrequest request, httpservletresponse response)         throws servletexception, ioexception {     processrequest(request, response); }  /**  * handles http <code>post</code> method.  *  * @param request servlet request  * @param response servlet response  * @throws servletexception if servlet-specific error occurs  * @throws ioexception if i/o error occurs  */ @override protected void dopost(httpservletrequest request, httpservletresponse response)         throws servletexception, ioexception {     processrequest(request, response); }  /**  * returns short description of servlet.  *  * @return string containing servlet description  */ @override public string getservletinfo() {     return "short description"; }// </editor-fold>  } 

when run code , try , login, keep getting this: server error 500: "java.lang.nullpointerexception"

were trying pass contents of html text fields function searches db email , password , returns user class.

if user class has type of "admin" login should take him admin page doesn't.

all nullpointexceptions seem linked passing email , password user manager ive tested setting specific values match db variable email , password still getting same error.

help appreciated.

output stack glassfish server: http://pastebin.com/yc6gtvip

you got lots of sql errors because database cannot found. underlying problem this:

java.io.filenotfoundexception: c:\users\112419442\desktop\bootstraplogin\sql\createdb.txt 

which prevents creation of database.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -