The
ran a new SSI framework today. reported the following error:
Serious: Exception sending context initialized event to listener instance of class Com.j.chat.upgrade.web.core.systemlaunchlis
Tener java.lang.IllegalStateException:No webapplicationcontext found:no contextloaderlistener registered? At Org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext ( webapplicationcontextutils.java:84) at com.j.chat.upgrade.web.core.systemlaunchlistener.contextinitialized ( systemlaunchlistener.java:27) at Org.apache.catalina.core.StandardContext.listenerStart (Standardcontext.java : 4779) at Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5273) at Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150) at org.apache.catalina.core.containerbase$ Startchild.call (containerbase.java:1566) at Org.apache.catalina.core.containerbase$startchild.call ( containerbase.java:1556) at Java.util.concurrent.futuretask$sync.innerrun (futuretask.java:303) at Java.util.concurrent.FutureTask.run (Futuretask.java:138) at Java.util.concurrent.threadpoolexecutor$worker.runtask (threadpoolexecutor.java:886) at Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:908) at Java.lang.Thread.run ( thread.java:662) 2014-7-14 19:49:10 org.apache.catalina.core.ApplicationContext log information: initializing Spring root Webapplicationcontext
I'm wondering, I've already declared Contextloaderlistener this listener in Web.xml. My web.xml configuration file is as follows:
<listener>
<listener-class>com.j.chat.upgrade.web.core.systemlaunchlistener</listener-class >
</listener>
<listener>
<listener-class> org.springframework.web.context.contextloaderlistener</listener-class>
</listener>
< context-param>
<param-name>contextConfigLocation</param-name>
<param-value> Classpath:spring-config.xml</param-value>
</context-param>
Analysis, I was in systemlaunchlistener inside execution, found Contextloaderlistener This listener is not registered. Is it because these two listener were executed successively. Tune the order of the two listeners and put the spring listener at the front. Restart Tomcat, there is no such an error.
Online Search the next Web.xml file in the listener order of execution. Here's a plausible statement:
Described in the Java Web specification. Initialized in the order of Listner,filter,servlet. The listener are executed in the order in which they are declared in Web.xml, and there is no concurrency.