툴 [Tool]

[전자정부프레임워크] 프로젝트 생성 후 시작시 'egovPageLinkWhitelist' NoSuchBeanDefinitionException 발생원인

도로락 2019. 11. 27. 22:52
전자정부프레임워크 로젝트 생성 후 시작시 'egovPageLinkWhitelist' NoSuchBeanDefinitionException 오류
전정부 프로젝트를 생성한 후 공통 컴포넌트를 추가하고 서버를 시작했더니 서버 시작시 다음과 같은 예외가 발생하였습니다.
[log4j]2019-11-19 20:16:33,794  WARN  [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization -  cancelling refresh attempt:  org.springframework.beans.factory.BeanCreationException: Error  creating bean with name 'egovComUtlController': Injection of  resource dependencies failed; nested exception is  org.springframework.beans.factory.NoSuchBeanDefinitionException:  No bean named 'egovPageLinkWhitelist' available
[log4j]2019-11-19 20:16:33,794 ERROR  [org.springframework.web.servlet.DispatcherServlet] Context  initialization failed
org.springframework.beans.factory.BeanCreationException: Error  creating bean with name 'egovComUtlController': Injection of  resource dependencies failed; nested exception is  org.springframework.beans.factory.NoSuchBeanDefinitionException:  No bean named 'egovPageLinkWhitelist' available
     at  org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:321)  ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1268) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)  ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
     at  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)  ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)  ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
cs



매번 발생하는 오류는 아니고 일부 공통컴포넌트만 추가했을 경우에 화이트리스트 관련 설정 xml파일이 생성되지 않아 발생하는 문제같습니다. 해결법으로는 all-in-one 프로젝트를 생성한 후  all-in-one 프로젝트에서 context-whitelist.xml 파일을 복사하여 붙여넣으면 해결됩니다.



all-in-one 프로젝트를 만들기 귀찮은 경우에는 context-whitelist.xml를 직접 생성 후 아래 내용을 붙여넣으시면 됩니다.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:context="http://www.springframework.org/schema/context"
     xmlns:util="http://www.springframework.org/schema/util"
     xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
               http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-4.0.xsd
               http://www.springframework.org/schema/util  http://www.springframework.org/schema/util/spring-util-2.5.xsd">
 
 
     <!-- /EgovPageLink.do 화이트 리스트 처리 (대상목록) -->
     <util:list id="egovPageLinkWhitelist"  value-type="java.lang.String">
          <value>/egovframework/com/sym/mnu/stm/EgovSiteMap</value>
           <value>/cmm/sym/mpm/EgovSiteMap</value>
           <value>/egovframework/com/main_bottom</value>
           
           <!--  <value>/egovframework/com/sec/rnc/EgovCallGpin</value>
           <value>cmm/sec/rnc/EgovCallGpin</value>
          <value>utl/sys/wsi/EgovWebStandardInspectionUriDirect</value>
          <value>utl/sys/wsi/EgovWebStandardInspectionUri</value>
          <value>utl/sys/wsi/EgovWebStandardInspectionUriDirectLink</value> -->
     </util:list>
 
 
     <!-- 820. RSS태그관리 -->
     <util:list id="egovRSSWhitelist"  value-type="java.lang.String">
           <value>comthtrsmrcvmntrngloginfo</value>
           <value>comtczip</value>
     </util:list>
     
     <!-- 실명인증 nextUrl -->
     <util:list id="egovNextUrlWhitelist"  value-type="java.lang.String">
           <value>/uss/umt/EgovMberSbscrbView.do</value>
           <value>/uss/umt/EgovEntrprsMberSbscrbView.do</value>
           <value>/uss/olh/qna/QnaCnRegistView.do</value>
     </util:list>
     
</beans>
cs