RE: Need help on Session's null pointer exception

2001-12-04 Thread bill . zhao


Thank you Larry, your comments are very helpful.  I will check my prinln()
to see if there is anything missing.


Bill




Larry Isaacs <[EMAIL PROTECTED]> on 12/04/2001 03:41:49 PM

Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>

To:   "'Tomcat Users List'" <[EMAIL PROTECTED]>
cc:

Subject:  RE: Need help on Session's null pointer exception


In Jdk 1.3.1, line 380 is where java.util.Hashtable.put()
throws an NPE after testing the "value" for "null".  In
ServerSession.setAttribute(), other than logging, there
is only "attributes.put(name, value);".

At this point, I think it is more likely there is a bug
in your println()s and the value is actually null.

Hope this helps.

Cheers,
Larry

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 04, 2001 3:24 PM
> To: Tomcat Users List
> Subject: RE: Need help on Session's null pointer exception
>
>
>
> I am sure neither the name nor the value is null in the code.  I used
> System.out.println() to print the name and value before I put it in a
> session.  This must be something else.
>
> Bill
>
>
>
>
> Larry Isaacs <[EMAIL PROTECTED]> on 12/04/2001 03:02:24 PM
>
> Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>
>
> To:   "'Tomcat Users List'" <[EMAIL PROTECTED]>
> cc:
>
> Subject:  RE: Need help on Session's null pointer exception
>
>
> The Servlet 2.2 spec states that neither the name or
> object may be null.  This is the spec that Tomcat 3.3 is the
> reference implementation for.
>
> The Servlet 2.3 spec allows the object to be null, which is
> the equivalent of calling removeAttribute().  This is why
> the code works in Tomcat 4.0.1.
>
> Cheers,
> Larry
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 04, 2001 2:51 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Need help on Session's null pointer exception
> >
> >
> >
> > Thank you for your reply, Denis.
> > I am sure the value I try to put  in a session is not null.  We used
> > Websphere and Tomcat 4.0.1 as our testing environment and the
> > codes are
> > running OK.  Only when we tried to use Tomcat3.3 giving us
> this error
> > message.  We suspect either our setting in wrong or there
> is a bug in
> > Tomcat3.3.
> >
> >
> > Bill
> >
> >
> >
> >
> > "Denis Balazuc" <[EMAIL PROTECTED]> on 12/04/2001 02:38:37 PM
> >
> > Please respond to "Tomcat Users List"
> <[EMAIL PROTECTED]>
> >
> > To:   "Tomcat Users List" <[EMAIL PROTECTED]>
> > cc:
> >
> > Subject:  Re: Need help on Session's null pointer exception
> >
> >
> > Hi
> >
> > You are simply trying to set a null value in a session, which is
> > forbidden.something like
> session.setAttribute("HelloWorld", null);
> >
> > I'm not sure this behaviour is specified in JSP specs though
> > it's more because a Hashtable is used as the Map to store
> > key=value session
> > attributes within Tomcat.
> >
> >
> > > I run a servlet on Tomcat3.3 and got the following error:
> > >
> > > java.lang.NullPointerException
> > > at java.util.Hashtable.put(Hashtable.java:380)
> > > at
> > org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
> > > Source)
> > > Can anyone kindly tell me what is wrong with my setting?  I
> > changed the
> > > expiration time for session in server.xml
> > > and I am sure the SessionIdGenerator is set too.
> > >
> > >
> > > Bill
> > >
> > >
> > > --
> > > To unsubscribe:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands:
> > <mailto:[EMAIL PROTECTED]>
> > > Troubles with the list:
> > <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > --
> > To unsubscribe:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands:
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands:
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list:
> <mailto:[EMAIL PROTECTED]>
> >
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>








--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Need help on Session's null pointer exception

2001-12-04 Thread Larry Isaacs

In Jdk 1.3.1, line 380 is where java.util.Hashtable.put()
throws an NPE after testing the "value" for "null".  In
ServerSession.setAttribute(), other than logging, there
is only "attributes.put(name, value);".

At this point, I think it is more likely there is a bug
in your println()s and the value is actually null.

Hope this helps.

Cheers,
Larry

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 04, 2001 3:24 PM
> To: Tomcat Users List
> Subject: RE: Need help on Session's null pointer exception
> 
> 
> 
> I am sure neither the name nor the value is null in the code.  I used
> System.out.println() to print the name and value before I put it in a
> session.  This must be something else.
> 
> Bill
> 
> 
> 
> 
> Larry Isaacs <[EMAIL PROTECTED]> on 12/04/2001 03:02:24 PM
> 
> Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>
> 
> To:   "'Tomcat Users List'" <[EMAIL PROTECTED]>
> cc:
> 
> Subject:  RE: Need help on Session's null pointer exception
> 
> 
> The Servlet 2.2 spec states that neither the name or
> object may be null.  This is the spec that Tomcat 3.3 is the
> reference implementation for.
> 
> The Servlet 2.3 spec allows the object to be null, which is
> the equivalent of calling removeAttribute().  This is why
> the code works in Tomcat 4.0.1.
> 
> Cheers,
> Larry
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 04, 2001 2:51 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Need help on Session's null pointer exception
> >
> >
> >
> > Thank you for your reply, Denis.
> > I am sure the value I try to put  in a session is not null.  We used
> > Websphere and Tomcat 4.0.1 as our testing environment and the
> > codes are
> > running OK.  Only when we tried to use Tomcat3.3 giving us 
> this error
> > message.  We suspect either our setting in wrong or there 
> is a bug in
> > Tomcat3.3.
> >
> >
> > Bill
> >
> >
> >
> >
> > "Denis Balazuc" <[EMAIL PROTECTED]> on 12/04/2001 02:38:37 PM
> >
> > Please respond to "Tomcat Users List" 
> <[EMAIL PROTECTED]>
> >
> > To:   "Tomcat Users List" <[EMAIL PROTECTED]>
> > cc:
> >
> > Subject:  Re: Need help on Session's null pointer exception
> >
> >
> > Hi
> >
> > You are simply trying to set a null value in a session, which is
> > forbidden.something like 
> session.setAttribute("HelloWorld", null);
> >
> > I'm not sure this behaviour is specified in JSP specs though
> > it's more because a Hashtable is used as the Map to store
> > key=value session
> > attributes within Tomcat.
> >
> >
> > > I run a servlet on Tomcat3.3 and got the following error:
> > >
> > > java.lang.NullPointerException
> > > at java.util.Hashtable.put(Hashtable.java:380)
> > > at
> > org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
> > > Source)
> > > Can anyone kindly tell me what is wrong with my setting?  I
> > changed the
> > > expiration time for session in server.xml
> > > and I am sure the SessionIdGenerator is set too.
> > >
> > >
> > > Bill
> > >
> > >
> > > --
> > > To unsubscribe:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands:
> > <mailto:[EMAIL PROTECTED]>
> > > Troubles with the list:
> > <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > --
> > To unsubscribe:   
> <mailto:[EMAIL PROTECTED]>
> > For additional commands: 
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: 
> <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe:   
> <mailto:[EMAIL PROTECTED]>
> > For additional commands: 
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: 
> <mailto:[EMAIL PROTECTED]>
> >
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Need help on Session's null pointer exception

2001-12-04 Thread bill . zhao


I am sure neither the name nor the value is null in the code.  I used
System.out.println() to print the name and value before I put it in a
session.  This must be something else.

Bill




Larry Isaacs <[EMAIL PROTECTED]> on 12/04/2001 03:02:24 PM

Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>

To:   "'Tomcat Users List'" <[EMAIL PROTECTED]>
cc:

Subject:  RE: Need help on Session's null pointer exception


The Servlet 2.2 spec states that neither the name or
object may be null.  This is the spec that Tomcat 3.3 is the
reference implementation for.

The Servlet 2.3 spec allows the object to be null, which is
the equivalent of calling removeAttribute().  This is why
the code works in Tomcat 4.0.1.

Cheers,
Larry

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 04, 2001 2:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Need help on Session's null pointer exception
>
>
>
> Thank you for your reply, Denis.
> I am sure the value I try to put  in a session is not null.  We used
> Websphere and Tomcat 4.0.1 as our testing environment and the
> codes are
> running OK.  Only when we tried to use Tomcat3.3 giving us this error
> message.  We suspect either our setting in wrong or there is a bug in
> Tomcat3.3.
>
>
> Bill
>
>
>
>
> "Denis Balazuc" <[EMAIL PROTECTED]> on 12/04/2001 02:38:37 PM
>
> Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>
>
> To:   "Tomcat Users List" <[EMAIL PROTECTED]>
> cc:
>
> Subject:  Re: Need help on Session's null pointer exception
>
>
> Hi
>
> You are simply trying to set a null value in a session, which is
> forbidden.something like session.setAttribute("HelloWorld", null);
>
> I'm not sure this behaviour is specified in JSP specs though
> it's more because a Hashtable is used as the Map to store
> key=value session
> attributes within Tomcat.
>
>
> > I run a servlet on Tomcat3.3 and got the following error:
> >
> > java.lang.NullPointerException
> > at java.util.Hashtable.put(Hashtable.java:380)
> > at
> org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
> > Source)
> > Can anyone kindly tell me what is wrong with my setting?  I
> changed the
> > expiration time for session in server.xml
> > and I am sure the SessionIdGenerator is set too.
> >
> >
> > Bill
> >
> >
> > --
> > To unsubscribe:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands:
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>








--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Need help on Session's null pointer exception

2001-12-04 Thread Craig R. McClanahan



On Tue, 4 Dec 2001, Sobeck, James (ISS Atlanta) wrote:

> Date: Tue, 4 Dec 2001 14:35:00 -0500
> From: "Sobeck, James (ISS Atlanta)" <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: 'Tomcat Users List' <[EMAIL PROTECTED]>
> Subject: RE: Need help on Session's null pointer exception
>
> I think i got that error once when i tried to put a null Object into
> session. do something like
>
> if (Object != null){
>   session.putValue("key", Object);
> }
>

You should also note that in a Servlet 2.3 environment, calling:

  session.setAttribute("key", null);

is semantically equivalent to calling:

  session.removeAttribute("key");

The bottom line is that it's not legal to store null attributes -- and
this applies to request, session, and ServletContext attributes equally.

> -hope that helps,
>
> Jimmy

Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Need help on Session's null pointer exception

2001-12-04 Thread Larry Isaacs

The Servlet 2.2 spec states that neither the name or
object may be null.  This is the spec that Tomcat 3.3 is the
reference implementation for.

The Servlet 2.3 spec allows the object to be null, which is
the equivalent of calling removeAttribute().  This is why
the code works in Tomcat 4.0.1.

Cheers,
Larry

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 04, 2001 2:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Need help on Session's null pointer exception
> 
> 
> 
> Thank you for your reply, Denis.
> I am sure the value I try to put  in a session is not null.  We used
> Websphere and Tomcat 4.0.1 as our testing environment and the 
> codes are
> running OK.  Only when we tried to use Tomcat3.3 giving us this error
> message.  We suspect either our setting in wrong or there is a bug in
> Tomcat3.3.
> 
> 
> Bill
> 
> 
> 
> 
> "Denis Balazuc" <[EMAIL PROTECTED]> on 12/04/2001 02:38:37 PM
> 
> Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>
> 
> To:   "Tomcat Users List" <[EMAIL PROTECTED]>
> cc:
> 
> Subject:  Re: Need help on Session's null pointer exception
> 
> 
> Hi
> 
> You are simply trying to set a null value in a session, which is
> forbidden.something like session.setAttribute("HelloWorld", null);
> 
> I'm not sure this behaviour is specified in JSP specs though
> it's more because a Hashtable is used as the Map to store 
> key=value session
> attributes within Tomcat.
> 
> 
> > I run a servlet on Tomcat3.3 and got the following error:
> >
> > java.lang.NullPointerException
> > at java.util.Hashtable.put(Hashtable.java:380)
> > at 
> org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
> > Source)
> > Can anyone kindly tell me what is wrong with my setting?  I 
> changed the
> > expiration time for session in server.xml
> > and I am sure the SessionIdGenerator is set too.
> >
> >
> > Bill
> >
> >
> > --
> > To unsubscribe:   
> <mailto:[EMAIL PROTECTED]>
> > For additional commands: 
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: 
> <mailto:[EMAIL PROTECTED]>
> >
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Re: Need help on Session's null pointer exception

2001-12-04 Thread bill . zhao


Thank you for your reply, Denis.
I am sure the value I try to put  in a session is not null.  We used
Websphere and Tomcat 4.0.1 as our testing environment and the codes are
running OK.  Only when we tried to use Tomcat3.3 giving us this error
message.  We suspect either our setting in wrong or there is a bug in
Tomcat3.3.


Bill




"Denis Balazuc" <[EMAIL PROTECTED]> on 12/04/2001 02:38:37 PM

Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>

To:   "Tomcat Users List" <[EMAIL PROTECTED]>
cc:

Subject:  Re: Need help on Session's null pointer exception


Hi

You are simply trying to set a null value in a session, which is
forbidden.something like session.setAttribute("HelloWorld", null);

I'm not sure this behaviour is specified in JSP specs though
it's more because a Hashtable is used as the Map to store key=value session
attributes within Tomcat.


> I run a servlet on Tomcat3.3 and got the following error:
>
> java.lang.NullPointerException
> at java.util.Hashtable.put(Hashtable.java:380)
> at org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
> Source)
> Can anyone kindly tell me what is wrong with my setting?  I changed the
> expiration time for session in server.xml
> and I am sure the SessionIdGenerator is set too.
>
>
> Bill
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>








--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Re: Need help on Session's null pointer exception

2001-12-04 Thread Denis Balazuc

Hi

You are simply trying to set a null value in a session, which is
forbidden.something like session.setAttribute("HelloWorld", null);

I'm not sure this behaviour is specified in JSP specs though
it's more because a Hashtable is used as the Map to store key=value session
attributes within Tomcat.


> I run a servlet on Tomcat3.3 and got the following error:
>
> java.lang.NullPointerException
> at java.util.Hashtable.put(Hashtable.java:380)
> at org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
> Source)
> Can anyone kindly tell me what is wrong with my setting?  I changed the
> expiration time for session in server.xml
> and I am sure the SessionIdGenerator is set too.
>
>
> Bill
>
>
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 
>


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Need help on Session's null pointer exception

2001-12-04 Thread Sobeck, James (ISS Atlanta)

I think i got that error once when i tried to put a null Object into
session. do something like

if (Object != null){
session.putValue("key", Object);
}

-hope that helps, 

Jimmy
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 04, 2001 2:26 PM
To: [EMAIL PROTECTED]
Subject: Need help on Session's null pointer exception


I run a servlet on Tomcat3.3 and got the following error:

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:380)
at org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
Source)
at =
org.apache.tomcat.facade.HttpSessionFacade.setAttribute(Unknown Sourc
e)
at org.apache.tomcat.facade.HttpSessionFacade.putValue(Unknown =
Source)
at =
com.fub.its.servlet.SecuredServlet.setCurrentEmployee(SecuredServlet.
java:162)
at =
com.fub.its.controller.DepartmentController.checkForSwitchToDepartmen
t(DepartmentController.java:47)
at =
com.fub.its.controller.DepartmentController.doGet(DepartmentControlle
r.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at =
com.fub.its.servlet.ApplicationServlet.service(ApplicationServlet.jav
a:160)
at =
com.fub.its.servlet.SecuredServlet.service(SecuredServlet.java:129)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown =
Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown =
Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown =
Source)

at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at =
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(
Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown =
Source)
at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
 Source)
at java.lang.Thread.run(Thread.java:484)
--End of System Error---



Can anyone kindly tell me what is wrong with my setting?  I changed the
expiration time for session in server.xml
and I am sure the SessionIdGenerator is set too.


Bill


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 

--
To unsubscribe:   
For additional commands: 
Troubles with the list: