-
Cannot find the declaration of element ‘beans’. 에러 해결웹 개발/에러 해결 2018. 3. 15. 13:38
서버 배포 중에 이런 로그를 남겨두고 실행되지 않았다.
[ERROR] [2018-03-14 18:19:14] (ContextLoader.java:308) -> Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 7 in XML document from file [/home/neos/tomcat/webapps/cust/WEB-INF/classes/config/spring/context-transaction.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 112; cvc-elt.1: Cannot find the declaration of element 'beans'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) ~[spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) ~[spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131) ~[spring-context-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522) ~[spring-context-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436) ~[spring-context-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) ~[spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016) [catalina.jar:7.0.59]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524) [catalina.jar:7.0.59]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.59]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.59]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.59]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649) [catalina.jar:7.0.59]
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081) [catalina.jar:7.0.59]
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877) [catalina.jar:7.0.59]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_121]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_121]
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[xercesImpl-2.9.1.jar:?]
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
... 26 more
이런 에러일 경우, 첫번째로 에러가 난 xml 파일에 xsi:scehmaLocation에서 xsd 버전과 스프링 버전이 맞는지 체크해야한다.
내 경우는 xsd 버전은 3.2 였는데,
123456<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">cs 스프링 버전이 3.1.1 버전이라 pom.xml에서 스프링 버전을 3.2 버전대로 업그레이드 시켰다.(빨간색부분 참조)
12345678910<properties><java-version>1.7</java-version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><spring.maven.artifact.version>3.2.9.RELEASE</spring.maven.artifact.version><org.aspectj-version>1.6.10</org.aspectj-version><org.slf4j-version>1.6.6</org.slf4j-version><maven.test.skip>true</maven.test.skip><egovframework.rte.version>3.5.0</egovframework.rte.version></properties>cs (* 여기서 바로 해결이 안됐지만, 다른 에러이므로 다른 포스팅에서 올림)
그래도 해결이 안된다?
둘째로 오타가 있는데 체크해야한다.
구글링에서 어떤 사람은 xsi:schemaLocation을 xsi:schemlocation 즉, 대문자 L을 써야하는데 소문자 l을 써서
찾지 못했다고 한다.
'웹 개발 > 에러 해결' 카테고리의 다른 글
[Eclipse] 이클립스 톰캣 등록(추가) 안되는 오류(등록 단계가 disabled 상태) (0) 2018.03.23 spring-asm-3.2.9.RELEASE.jar!/] for TLD files java.util.zip.ZipException: error in opening zip file (0) 2018.03.15 JSP 에러 페이지 간단하게 처리하기 (0) 2018.02.28 maven build 에러 해결방법 (8) 2018.02.18 MariaDB 사용 중 에러: General error: 1615 Prepared statement needs to be re-prepared (0) 2018.02.18