Thursday, March 17, 2005
Webspher Error: No WebApplicationContext found: no ContextLoaderListener registered?
I was getting the following error when I added a brand new application to the Webpher production machine. The problem is the following: For Servlet 2.2 containers and Servlet 2.3 ones that do not initalize listeners before servlets, use ContextLoaderServlet. See the latter's Javadoc for details. IBM Websphere Application Server 5.1.1 operates its container at Servlet 2.3 and thus the listener is not registered before the servlets and therefore I get errors.
More Here
I fixed this error by changing the following in the web.xml file:
**this used to be the way we started the ContextLoaderListner for Spring but this stopped working.
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
the servlet method below works fine on the Webspher production server... I need to find out why the listner is not working.
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
[3/17/05 15:33:47:422 CST] 715abdb4 WebGroup E
SRVE0026E: [Servlet Error]-[action]:
java.lang.IllegalStateException: No WebApplicationContext
found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplicationContextU
tils.getRequiredWebApplicationContext
(WebApplicationContextUtils.java:69)
at edu.uga.busfin.budamd.web.ElectronicApprovalBaseDispatchAction
.setServlet(ElectronicApprovalBaseDispatchAction.java:35)
at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:297)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:220)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119) at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
