Wednesday, 28 August 2013

WebApplicationInitializer container.addServlet() returns null

WebApplicationInitializer container.addServlet() returns null

I'm creating a basic web app with maven, then importing to Eclipse 4.2. I
have Tomcat 7 setup as a server. I'm trying configure spring data with
mongodb for a web app.
I'm following the code-based configuration approach found here:
WebApplicationInitializer
When I run the project on the server, I get a null pointer exception in
the WebApplicationInitializer class I have created. The line
container.addServlet("dispatcher", new
DispatcherServlet(dispatcherContext)); is returning null.
What the heck am I missing? I'm a bit new to creating web-apps from
scratch using annotations.
Thanks

No comments:

Post a Comment