This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setAttribute() is not working in Lisntener class

 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been problem with setAttribute() in ContextListener class.
When I get the value via getAttribute ,I receive the ugly null pointer
exception and it doesn't fade away.I tried hard to solve it without success.
//Bear class

//ContextListener class

//Sevlet Class

//DD


//exception


best regards,
omi
[ May 17, 2008: Message edited by: omi sharma ]
 
Prasad Tamirisa
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you write the following code...??


You should have been written it in the overridden contextInitialized method. Am i right..??

The above code should have been called before you call your servlet class.
[ May 17, 2008: Message edited by: Prasad Tamirisa ]
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prasad Tamirisa:
Where did you write the following code...??


You should have been written it in the overridden contextInitialized method. Am i right..??

The above code should have been called before you call your servlet class.

[ May 17, 2008: Message edited by: Prasad Tamirisa ]


Wrong !! , you just did not get it.I wrote the code inside the overridden
function,I did put only useful code here so that you can easily and quickly
read and solve the problem.

I created several class Cat,Dog,Snake using the same methodology and they
do not give any damn problem like this Bear class.

The problem is in setAttribute() as I stated that.Actually I could not be
able to locate what the problem is?

Just I get vomiting and appalling null pointer exception.

so please give it a second thought.

best regards,
omi
[ May 17, 2008: Message edited by: omi sharma ]
 
Prasad Tamirisa
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you just did not get it.I wrote the code inside the overridden
function,


I am confused...
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry I did not notice you said exactly what I did.

Actually I forgot to set Listener configuration on DD.

Now everything is fine.

by the way contextIntialized() is automatically called before the servlet class if and only if I set listener on dd.

best regards,
omi
[ May 17, 2008: Message edited by: omi sharma ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic