tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexis <alz...@gmail.com>
Subject Re: custom class as resource
Date Mon, 31 Jan 2011 21:48:09 GMT
The only difference i found is

the class that sets the attribute on the servletcontext extends ServletContextListener.

the class that access and reads the context extends HttpServlet and shows the content upon
an http request.

the class that gets the null pointer, also extends HttpServlet but it's instantiated from
another class and a method is called from there. there's no http request on this class. i've
also declared this class as a servlet in the web.xml of my app.


On Jan 31, 2011, at 4:40 PM, Caldarale, Charles R wrote:

>> From: alexis [mailto:alzrck@gmail.com] 
>> Subject: Re: custom class as resource
> 
>>    LiveInfo li = (LiveInfo) sc.getAttribute("live");
> 
>> why im getting a null pointer on the sc.getAttribute line?
> 
> Because you never created an attribute named "live" in the ServletContext.
> 
> - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and
is thus for use only by the intended recipient. If you received this in error, please contact
the sender and delete the e-mail and its attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Mime
View raw message