java - Spring : BeanFactory not initialized or already closed -


when adding cacheclients.xml file in applicationcontext.xml getting below exception

java.lang.illegalstateexception: beanfactory not initialized or closed - call 'refresh' before accessing beans via applicationcontext     @ org.springframework.context.support.abstractrefreshableapplicationcontext.getbeanfactory(abstractrefreshableapplicationcontext.java:170)     @ org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:921)     @ org.springframework.context.support.abstractapplicationcontext.doclose(abstractapplicationcontext.java:895)     @ org.springframework.context.support.abstractapplicationcontext.close(abstractapplicationcontext.java:841)     @ org.springframework.web.context.contextloader.closewebapplicationcontext(contextloader.java:579)     @ org.springframework.web.context.contextloaderlistener.contextdestroyed(contextloaderlistener.java:115)     @ org.apache.catalina.core.standardcontext.listenerstop(standardcontext.java:4980)     @ org.apache.catalina.core.standardcontext.stopinternal(standardcontext.java:5626)     @ org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:160)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:745) 

and file cacheclient.xml file

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">              <bean name="announcementclient" class="com.ccc.service.cache.clients.genericcompanycacheclient" init-method="init">                 <property name="cachemanager" ref="cachemanager"/>                 <property name="cachename" value="valid_data"/>                 <property name="dbquery" value="select * validstatus"  />                 <property name="clientname" value="validstatus" />                 <property name="modulename" value="valid_status" />             </bean>             <bean name="quarterlyresultsclient" class="com.ccc.service.cache.clients.genericcompanycacheclient" init-method="init">                 <property name="cachemanager" ref="cachemanager"/>                 <property name="cachename" value="valid_data"/>                 <property name="dbquery" value="select * validuserrole" />                 <property name="clientname" value="validuserrole" />                 <property name="modulename" value="valid_user_role" />             </bean>   </beans> 

in applicationcontext.xml file added

<import resource="cacheclients.xml" />  

when removing above import working fine

web.xml entries

<context-param>         <param-name>contextconfiglocation</param-name>         <param-value>             /web-inf/applicationcontext.xml         </param-value>     </context-param>  <listener>         <listener-class>org.springframework.web.context.contextloaderlistener</listener-class>     </listener>     <listener>         <listener-class>             org.springframework.web.context.request.requestcontextlistener</listener-class>     </listener> 

are using tomcat in eclipse. refresh project,maven build , maven update project , let me know if still facing issue.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -