KimD
160
2018-10-26 16:53:11
7
2237

갑자기 applicationContext를 못찾는 경우 어떻게 해야할까요?



java.lang.ClassNotFoundException: net.kepco.kldnet.InitServlet
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
	at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:495)
	at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:477)
	at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1133)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)

10월 26, 2018 4:48:49 오후 org.apache.catalina.core.ApplicationContext log
정보: Initializing Spring FrameworkServlet 'appServlet'
10월 26, 2018 4:48:50 오후 org.apache.catalina.core.ApplicationContext log
심각: StandardWrapper.Throwable
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
	at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
	... 27 more

10월 26, 2018 4:48:50 오후 org.apache.catalina.core.StandardContext loadOnStartup
심각: Servlet [appServlet] in web application [/kldnet] threw load() exception
java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
	at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)


	<servlet>
		<servlet-name>appServlet</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:applicationContext.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>


원래 돌아가던 소스인데 갑자기 저렇게 오류 뜨면서 실행이 안되네요.

분명 위치는 src밑에 정확하게 applicationContext.xml가 있습니다.

제가 코딩하다 실수했나 해서 롤백도 해봤는데 해결이 안되네요. 죽겠어요..

0
  • 답변 7

  • 협이
    785
    2018-10-26 17:00:14
    java.lang.ClassNotFoundException: net.kepco.kldnet.InitServlet

    가장 첫 줄에 InitServlet 클래스를 못찾는다고 나오는데 매핑이 제대로 되어있나 설정이 맞춰져있나

    확인해보셨나요?

  • KimD
    160
    2018-10-26 17:02:48


    	<servlet>
    		<servlet-name>appServlet</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>classpath:applicationContext.xml</param-value>
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet>
    	  <servlet-name>InitServlet</servlet-name>
    	  <servlet-class>net.kepco.kldnet.InitServlet</servlet-class>
    	  <load-on-startup>0</load-on-startup>
    	</servlet>

    InitServlet은 컨트롤+클릭으로도 정상접근됩니다.

  • 협이
    785
    2018-10-26 17:07:48

    서버에서 프로젝트 내리신 후 서버 디렉토리 클린 및 서버클린 후에 다시 올려보시는건...?

  • KimD
    160
    2018-10-26 17:09:02

    서버 클린하고 서버 디렉토리 클린이 다른건가요?


    프로젝트 클린 서버 클린, add and remove는 해봤고 디렉토리 클린 한번 해보겠습니다

  • KimD
    160
    2018-10-26 17:11:04

    여전히 안되네요..

  • 협이
    785
    2018-10-26 17:20:21

    webapps 폴더 쪽 배포된 프로젝트에 해당 파일이 없는게 아닐까요??


    현재로썬 파일이 없다고 뜨긴하니 정확히 파일 유무부터 확인해보시면 될거같은데

    그게 아니라면.. 음.. 뭔가가 설정이 꼬여있거나 한거같아요. 있는 파일을 못찾는 경우는 해당 파일을 가리키는 매핑이나 설정이 잘못되있는경우가 대부분이라서요

  • KimD
    160
    2018-10-26 18:30:15

    해결했습니다. 조언해주신분들 모두 감사핮니다.

    이클립스 맛가서 서버초기화하다 컨텍스트루트가 변경됬었네요..

    이 실수 하나때문에 몇시간을 버렸네요 ㅠㅠ

  • 로그인을 하시면 답변을 등록할 수 있습니다.