tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Odowd <tod...@PeopleAdmin.com>
Subject Objects lost in session
Date Tue, 30 Sep 2003 18:11:37 GMT
Sorry for the long email.

I am using Tomcat 4.124 for my servlet engine and IIS for my web server.

I am monitoring exceptions that occur in my system and this one has me
confused.  The exception is:
java.lang.NullPointerException
	at ParentClass.getQualificationMessage(ParentClass.java:483)
	at ChildClass.finishDocumentUpload(ChildClass.java:135)
	at ...

The parent class method is failing when it tries to call a method on the
Position object that it retrieved from the session.
It looks like the Position object is null in the session:

    protected static final String getQualificationMessage(
            HttpServletRequest request){
        HttpSession session = request.getSession();
        int employerId = ((Integer)session.getAttribute(RC.EMPLOYER_ID))
        		.intValue();
(483)        int positionId
                =
((Position)session.getAttribute(RC.POSITION)).getPositionId();
		...

What I can't explain is that the ChildClass method that has called the above
method was able to retrieve the position object from the session and call a
method on it.  That makes me believe that the position object existed in the
session at that time:


I have a Position object stored as a session attribute with the attribure
name RC.POSITION.

    protected static final String finishDocumentUpload(
            HttpServletRequest request, EmployerConfiguration ec){
        HttpSession session =request.getSession();   
        Position position = (Position)session.getAttribute(RC.POSITION);
        if (position.attachDocumentsOnly()){
        	return 	forwardToOriginalPage(request, ec); 
        } else {	  		       		
135	   	return getQualificationMessage(request);
		}   				
    }


I cannot reproduce this error (which is making me crazy), but I see similar
things happening every once in a while in my exception log.

Any ideas?

Thanks for your help,
-tim 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message