You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tim Odowd <to...@PeopleAdmin.com> on 2003/09/30 20:11:37 UTC

Objects lost in session

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 

StackOverFlowError--Please help

Posted by shyam <sh...@adamshand.net>.
Hi All,
I am having a problem when doing servlet chaining. I have a code snippet
like this

if(flag)
{
    requestdispatcher.forward(request,response);
}
else
{
    requestdispatcher.forward(request,response);
}

The problem is if flag is true the forward and I get the desired result. But
in the else case I get a java.lang.StackOverFlowError . The stack trace is


java.lang.StackOverflowError at
org.apache.catalina.core.ApplicationHttpRequest.removeAttribute(ApplicationH
ttpRequest.java:229)

And the error is at the forward of the false case. Can somebody help me with
this problem.

Thanks in advance,
shyam



StackOverFlowError--Please help

Posted by shyam <sh...@adamshand.net>.
Hi All,
I am having a problem when doing servlet chaining. I have a code snippet
like this

if(flag)
{
    requestdispatcher.forward(request,response);
}
else
{
    requestdispatcher.forward(request,response);
}

The problem is if flag is true the forward and I get the desired result. But
in the else case I get a java.lang.StackOverFlowError . The stack trace is


java.lang.StackOverflowError at
org.apache.catalina.core.ApplicationHttpRequest.removeAttribute(ApplicationH
ttpRequest.java:229)

And the error is at the forward of the false case. Can somebody help me with
this problem.

Thanks in advance,
shyam



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