spring - java.io.FileNotFoundException: class path resource [conf/admin/applicationContext.xml] cannot be opened because it does not exist -


i'm using spring security, reason web.xml isn't finding applicationcontext.xml web.xml

<context-param>     <param-name>contextconfiglocation</param-name>     <param-value>             classpath:conf/admin/applicationcontext.xml             classpath:conf/admin/applicationcontext-security.xml     </param-value> </context-param>  <filter>     <filter-name>springsecurityfilterchain</filter-name>     <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class> </filter>  <filter-mapping>     <filter-name>springsecurityfilterchain</filter-name>     <url-pattern>/*</url-pattern> </filter-mapping>  <listener>     <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> 

my applicationcontext.xml in myproject/conf/admin/applicationcontext.xml, in same place web.xml throws exception:

    14:18:07,793 error [contextloader] context initialization failed org.springframework.beans.factory.beandefinitionstoreexception: ioexception parsing xml document class path resource [conf/admin/applicationcontext.xml]; nested exception java.io.filenotfoundexception: class path resource [conf/admin/applicationcontext.xml] cannot opened because not exist 

i've tried putting inside web-inf folder ( every spring security tutorial ) in myproject/dist/web/web-inf, when clean project refresh , rebuild gets deleted.

so doing wrong? putting wrong path in contextconfiglocation or applicationcontext.xml in wrong place?

assuming following standard maven directory structure i.e. xml config files under src/main/webapp/web-inf/conf/admin try this:

<context-param>     <param-name>contextconfiglocation</param-name>     <param-value>         /web-inf/conf/admin/applicationcontext.xml         /web-inf/conf/admin/applicationcontext-security.xml     </param-value> </context-param> 

another approach go defaults:

  1. just place applicationcontext.xml file under src/main/webapp/web-inf , picked spring default.
  2. you can add <import resource="applicationcontext-security.xml" /> line in applicationcontext.xml import security config.
  3. check repository using default config approach.

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -