PDA

View Full Version : Question on ContextLoaderListener and WebApplicationContext


sonicfab
Apr 24th, 2007, 08:05 AM
I was reading the documentation regarding the ContextLoaderListener, and it says that the Listener loads a WebApplicationContext. Is it necessary that the application context defined in the web.xml necessarily be a WebApplicationContext ?

In our case, we define this in web.xml :

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beanRefContext.xml,
/WEB-INF/classes/com/bouygtel/inthd/ecf/spring/beans-jsf.xml</param-value>
</context-param>

and our beanRefContext is this :

<bean id="ecf.application.context" lazy-init="true"
class="org.springframework.context.support.ClassPathXmlAp plicationContext">
<constructor-arg>
<list>
<value>com/bouygtel/inthd/ecf/spring/beans.xml</value>
<value>com/bouygtel/inthd/sysint/ecf/beans/ECFBeans.xml</value>
</list>
</constructor-arg>
<constructor-arg>
<ref bean="commun.application.context" />
</constructor-arg>
</bean>


So in our case the application context is ClassPathXmlApplicationContext.
We are having some problems in finding the BeanFactory :

javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.el.EvaluationException: java.lang.IllegalStateException: BeanFactory not initial
ized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Could this problem be due to the fact that the ContextLoaderListener is looking only for a WebApplicationContext ??