This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes event.getServletContext() returning Null in a ServletContextListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "event.getServletContext() returning Null in a ServletContextListener" Watch "event.getServletContext() returning Null in a ServletContextListener" New topic
Author

event.getServletContext() returning Null in a ServletContextListener

Jason Soper
Greenhorn

Joined: Sep 01, 2009
Posts: 7
Hi Guys,

I have a ServletContextListener set up to add an ELResolver to the resolver chain. The listener looks a bit like this:



I have the listener registered in the web.xml like this:



This is all working fine on my local machine. The code is running wirhout error and the ELResolver is being added and functioning correctly.

My problem is when I run the code on our test server. I'm not sure what's different, but in that environment it falls over when it tries to use context. As far as I can tell, event.getServletContext() is returning null.

Can anyone suggest what might be causing this? Or is there another way of doing this? This is a Spring application, if that makes any difference.

Thanks,

Jason
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: event.getServletContext() returning Null in a ServletContextListener
 
It's not a secret anymore!