tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Buglass <adam.bugl...@ncl.ac.uk>
Subject Re: Mysterious Null Pointer Exception in Login script
Date Mon, 19 Apr 2004 10:58:06 GMT
No, everything seems to be compiling correctly.

It's the java file that I'm editing. The errors in the JSP seem to stem
from a problem in the Java file.

On Mon, 2004-04-19 at 11:47, Thomas Chua wrote:
> maybe ur new file is not compiled....
> try deleting ur work directory...
> the line 30 is base on the java file not the jsp file
> 
> 
> 
> 
> "Adam Buglass" <adam.buglass@ncl.ac.uk>
> 04/19/2004 06:33 PM
> Please respond to "Tomcat Users List"
> 
>  
>         To:     "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>         cc: 
> 
>         Subject:        Re: Mysterious Null Pointer Exception in Login script
> 
> 
> 
> Interestingly - I edited out the source file in question so that it only
> had about 15-20 lines.
> 
> It *still* claims that the exception is being thrown is at Line 30,
> although line 30 doesn't exist anymore. I'm stumped!  :-(
> 
> Adam
> 
> On Mon, 2004-04-19 at 11:29, Adam Buglass wrote:
> > I've commented out those particular error-checks for testing but with
> > them in or out whatever I put in the same message *always* comes up.
> > 
> > Even if I've changed the source file the error is always reported at
> > Line 30.
> > 
> > On Mon, 2004-04-19 at 11:27, Thomas Chua wrote:
> > > could the userid or passwd be null???
> > > 
> > > 
> > > 
> > > 
> > > "Adam Buglass" <adam.buglass@ncl.ac.uk>
> > > 04/19/2004 06:05 PM
> > > Please respond to "Tomcat Users List"
> > > 
> > > 
> > >         To:     "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> > >         cc: 
> > > 
> > >         Subject:        Re: Mysterious Null Pointer Exception in Login 
> script
> > > 
> > > 
> > > 
> > > Thanks, but I already had a look.
> > > The line causing the error in that file is the line that calls the
> > > method:  thisUser.login( userid, passwd );
> > > 
> > > Which itself appears to be causing the error, or am I missing 
> something?
> > > 
> > > The login_jsp.java file looks like this of you're interested:
> > > 
> > > package org.apache.jsp;
> > > 
> > > import javax.servlet.*;
> > > import javax.servlet.http.*;
> > > import javax.servlet.jsp.*;
> > > import org.apache.jasper.runtime.*;
> > > 
> > > public class login_jsp extends HttpJspBase {
> > > 
> > > 
> > >   private static java.util.Vector _jspx_includes;
> > > 
> > >   public java.util.List getIncludes() {
> > >     return _jspx_includes;
> > >   }
> > > 
> > > 
> > >   public void _jspService(HttpServletRequest request,
> > > HttpServletResponse response)
> > >         throws java.io.IOException, ServletException {
> > > 
> > >     JspFactory _jspxFactory = null;
> > >     javax.servlet.jsp.PageContext pageContext = null;
> > >     HttpSession session = null;
> > >     ServletContext application = null;
> > >     ServletConfig config = null;
> > >     JspWriter out = null;
> > >     Object page = this;
> > >     JspWriter _jspx_out = null;
> > > 
> > >     try {
> > >       _jspxFactory = JspFactory.getDefaultFactory();
> > >       response.setContentType("text/html;charset=ISO-8859-1");
> > >       pageContext = _jspxFactory.getPageContext(this, request, 
> response,
> > >                         null, true, 8192, true);
> > >       application = pageContext.getServletContext();
> > >       config = pageContext.getServletConfig();
> > >       session = pageContext.getSession();
> > >       out = pageContext.getOut();
> > >       _jspx_out = out;
> > > 
> > >       ISPSelfCare.Login thisUser = null;
> > >       synchronized (session) {
> > >         thisUser = (ISPSelfCare.Login)
> > > pageContext.getAttribute("thisUser", PageContext.SESSION_SCOPE);
> > >         if (thisUser == null){
> > >           try {
> > >             thisUser = (ISPSelfCare.Login)
> > > java.beans.Beans.instantiate(this.getClass().getClassLoader(),
> > > "ISPSelfCare.Login");
> > >           } catch (ClassNotFoundException exc) {
> > >             throw new InstantiationException(exc.getMessage());
> > >           } catch (Exception exc) {
> > >             throw new ServletException("Cannot create bean of class " 
> +
> > > "ISPSelfCare.Login", exc);
> > >           }
> > >           pageContext.setAttribute("thisUser", thisUser,
> > > PageContext.SESSION_SCOPE);
> > >         }
> > >       }
> > >       out.write("\n\n");
> > > 
> > >         String userid = request.getParameter( "userid" );
> > >         String passwd = request.getParameter( "passwd" );
> > > 
> > > //      if( userid == null || passwd == null )
> > > //              throw new RuntimeException( "Invalid arguments" );
> > > 
> > > 
> > > //      if( userid.length() == 0 )
> > > //              throw new RuntimeException( "Please provide your 
> dial-up
> > > user id." );
> > > 
> > > //      if( passwd.length() == 0 )
> > > //              throw new RuntimeException( "Please provide your 
> dial-up
> > > password." );
> > > 
> > > //      <jsp:useBean id="thisUser" class="ISPSelfCare.Login"
> > > scope="session" />
> > > //      <jsp:setProperty name="thisUser" property="custID" />
> > > //      <jsp:setProperty name="thisUser" property="userID" />
> > > //      <jsp:setProperty name="thisUser" property="login" />
> > > 
> > >         thisUser.login( userid, passwd );
> > > //      thisUser.something();
> > > 
> > > //      thisUser.setUserID( userid );
> > >         response.sendRedirect( "index.jsp" );
> > >       out.write("\n");
> > >     } catch (Throwable t) {
> > >       out = _jspx_out;
> > >       if (out != null && out.getBufferSize() != 0)
> > >         out.clearBuffer();
> > >       if (pageContext != null) pageContext.handlePageException(t);
> > >     } finally {
> > >       if (_jspxFactory != null)
> > > _jspxFactory.releasePageContext(pageContext);
> > >     }
> > >   }
> > > }
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > On Mon, 2004-04-19 at 10:58, Thomas Chua wrote:
> > > > try looking for this file in your work directory....
> > > > login_jsp._jspService(login_jsp.java:74)
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > "Adam Buglass" <adam.buglass@ncl.ac.uk>
> > > > 04/19/2004 05:41 PM
> > > > Please respond to "Tomcat Users List"
> > > > 
> > > > 
> > > >         To:     "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> > > >         cc: 
> > > > 
> > > >         Subject:        Mysterious Null Pointer Exception in Login 
> > > script
> > > > 
> > > > 
> > > > 
> > > > Hi, I hope this is the right list for this, it's been driving me up 
> the
> > > > wall!
> > > > 
> > > > First things first, I'm using tomcat servlet container 4.1 with Suns
> > > > J2SE 1.4.1
> > > > 
> > > > The problem is I have a simple login procedure whereby a user enters
> > > > their id and password into a JSP which passes the information to a 
> Java
> > > > Method. This method in turn checks the Database to see if the user 
> is
> > > > valid. If the user is valid a new session is created and the 
> information
> > > > stored in a bean.
> > > > 
> > > > So far so good, I've used this method on several occassions with no
> > > > trouble.
> > > > 
> > > > However when I attempt to login (with any set of data) I get a
> > > > NullPointerException at line 30 of the class file. Always the same
> > > > exception and always at line 30 no matter what I do. I can't find 
> any
> > > > useful info from the logs or the exception that's thrown.
> > > > 
> > > > Has anyone any thoughts on what may be causing this or pointers on 
> how
> > > > to solve it?
> > > > 
> > > > The offending page is at www.golduk.net/selfcare/index.jsp
> > > > 
> > > > Thanks,
> > > > Adam Buglass
> > > > 
> > > > 
> > > > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
-- 

Adam Buglass,  ><>
The Golden Freeway,
Department of Child Health,
University of Newcastle-upon-Tyne.
Royal Victoria Infirmary.

(0191) 2023062

"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote." 
~Benjamin Franklin, 1759


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message