프밍일기

스프링 컨테이너 <beans> 설정 유의사항 본문

Spring

스프링 컨테이너 <beans> 설정 유의사항

스에조theLED 2017. 3. 3. 12:31
■ 스프링 context 파일 <beans> 설정내용 :
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 						http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
						http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
						http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
						http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
 
■ 오류내용 : 
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tx/spring-tx-4.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>

■ 원인 :

사용중인 스프링 버전이 3.0인데 4.0 버전을 사용하겠다고 선언하여 내부 jar에서가 아닌 인터넷으로 연결하여 조회 시도하는데 인터넷이 사용불가한 환경이라 에러 발생


■ 해결

Namespace의 버전정보를 맞춰주거나 버전정보를 제거


■ 수정된 설정내용

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 						http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
						http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
						http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
						http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">




'Spring' 카테고리의 다른 글

Spring과 MyBatis 연동 예제  (2) 2017.04.07
AOP - Annotation  (0) 2017.03.24
AOP - XML  (0) 2017.03.24
DI(Dependency Injection, 의존성주입)  (0) 2017.01.28
IoC(Inversion of Control, 제어역전)  (0) 2017.01.28
Comments