반응형

스프링 3.X 버전 대의 프로젝트를 스프링 4.X 버전으로 올리려고 한다. 그래서, 기존 자바 프로젝트를 Maven 프로젝트로 변환하여 pom.xml을 만들었다. 이제 pom.xml을 만들었으니, pom.xml에 등록된 dependency와 properties 등을 수정하여 버전을 올리려고 한다. 이 방법은 정말 간단하게 할 수 있으니 그대로 따라하면 된다.(전혀 간단하지 않았다. 기존 3.0 프로젝트 구조가 개판이라서 엄청 뜯어고쳤다.)

2022.11.08 - [IT/이클립스(Eclipse)] - [이클립스/Eclipse] 이클립스(Eclipse) 자바 프로젝트 Maven 프로젝트로 변경하는 방법

 

[이클립스/Eclipse] 이클립스(Eclipse) 자바 프로젝트 Maven 프로젝트로 변경하는 방법

기존에 사용했던 프로젝트가 pom.xml이 없어서 dependency 추가도 어렵고 관리를 하기도 힘들었다. 그래서, 이 기회에 자바 프로젝트를 Maven 프로젝트로 변환을 해서 pom.xml을 생성하고 라이브러리 관

yongku.tistory.com

 

1. pom.xml에 아래의 코드를 붙여넣기를 한다.

- 이 코드의 spring 버전은 4.3.14 버전이다.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Cozip</groupId>
  <artifactId>Cozip</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>Cozip</name>
  <description>Cozip</description>
  
  <properties>
		<project.build.sourceencoding>UTF-8</project.build.sourceencoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<webapp.lib>${basedir}/WebContent/WEB-INF/lib</webapp.lib>
  </properties>
	
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.2</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
  
  <repositories>
		<repository>
			<id>oracle</id>
			<name>ORACLE JDBC Repository</name>
			<url>https://maven.atlassian.com/3rdparty/</url>
		</repository>
		<repository>
			<id>central</id>
			<name>central Repository</name>
			<url>https://repo1.maven.org/maven2/</url>
		</repository>
		<repository>
			<id>spring plugins</id>
			<name>Spring Plugins Repository</name>
			<url>https://repo.spring.io/plugins-release/</url>
		</repository>
	</repositories>
	
  <dependencies>
		<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin -->
		<dependency>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-resources-plugin</artifactId>
			<version>2.7</version>
		</dependency>
		
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-dbcp2</artifactId>
			<version>2.7.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.4</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.6</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.6</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.9</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-pool2</artifactId>
			<version>2.7.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.owasp.encoder/encoder -->
		<dependency>
			<groupId>org.owasp.encoder</groupId>
			<artifactId>encoder</artifactId>
			<version>1.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.owasp.encoder/encoder-jsp -->
		<dependency>
			<groupId>org.owasp.encoder</groupId>
			<artifactId>encoder-jsp</artifactId>
			<version>1.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-annotations</artifactId>
			<version>2.9.10</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>2.9.10</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.9.10.1</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail -->
		<dependency>
			<groupId>com.sun.mail</groupId>
			<artifactId>javax.mail</artifactId>
			<version>1.6.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.jdom/jdom -->
		<dependency>
			<groupId>org.jdom</groupId>
			<artifactId>jdom</artifactId>
			<version>1.1.3</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.json/json -->
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20160810</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.navercorp.lucy/lucy-xss -->
		<dependency>
			<groupId>com.navercorp.lucy</groupId>
			<artifactId>lucy-xss</artifactId>
			<version>1.6.3</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.navercorp.lucy/lucy-xss-servlet -->
		<dependency>
			<groupId>com.navercorp.lucy</groupId>
			<artifactId>lucy-xss-servlet</artifactId>
			<version>2.0.0</version>
		</dependency>


		<!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-servlet -->
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-servlet</artifactId>
			<version>2.0.0</version>
			<scope>runtime</scope>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.5.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>2.0.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.18</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.opencsv/opencsv -->
		<dependency>
			<groupId>com.opencsv</groupId>
			<artifactId>opencsv</artifactId>
			<version>3.8</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi</artifactId>
			<version>3.10-FINAL</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml</artifactId>
			<version>3.10-FINAL</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml-schemas</artifactId>
			<version>3.10-FINAL</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>42.2.18</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-aspects -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-expression -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-expression</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-instrument -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-instrument</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-jms -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jms</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-websocket -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-websocket</artifactId>
			<version>4.3.25.RELEASE</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
		<dependency>
			<groupId>org.apache.xmlbeans</groupId>
			<artifactId>xmlbeans</artifactId>
			<version>3.1.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-1.2-api</artifactId>
			<version>2.17.1</version>
		</dependency>

		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-api</artifactId>
			<version>2.17.1</version>
		</dependency>

		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>2.17.1</version>
		</dependency>

		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-jcl</artifactId>
			<version>2.17.1</version>
		</dependency>

		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-slf4j-impl</artifactId>
			<version>2.17.1</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.25</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.7.25</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.slf4j/jcl-over-slf4j -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>1.7.25</version>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
		<dependency>
		    <groupId>com.googlecode.json-simple</groupId>
		    <artifactId>json-simple</artifactId>
		    <version>1.1.1</version>
		</dependency>
		
		
		<dependency>
			<groupId>external</groupId>
			<artifactId>sapjco3</artifactId>
			<version>1.0</version>
			<scope>system</scope>
			<systemPath>${webapp.lib}/sapjco3.jar</systemPath>
		</dependency>
		
		<dependency>
			<groupId>external</groupId>
			<artifactId>elsjdbc</artifactId>
			<version>1.0</version>
			<scope>system</scope>
			<systemPath>${webapp.lib}/elsjdbc.jar</systemPath>
		</dependency>

		<dependency>
			<groupId>external</groupId>
			<artifactId>elsjdbc14</artifactId>
			<version>1.0</version>
			<scope>system</scope>
			<systemPath>${webapp.lib}/elsjdbc14.jar</systemPath>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
			<scope>provided</scope>
		</dependency>
		
		<dependency>
			<groupId>log4jdbc</groupId>
			<artifactId>log4j2-jdbc4</artifactId>
			<version>1.16</version>
			<scope>system</scope>
			<systemPath>${webapp.lib}/log4jdbc-log4j2-jdbc4-1.16.jar</systemPath>
		</dependency>
		
		<dependency>
			<groupId>log4jdbc</groupId>
			<artifactId>remix</artifactId>
			<version>0.27</version>
			<scope>system</scope>
			<systemPath>${webapp.lib}/log4jdbc-remix-0.2.7.jar</systemPath>
		</dependency>
		
		<dependency>
			<groupId>com.drewnoakes</groupId>
			<artifactId>metadata-extractor</artifactId>
			<version>2.6.2</version>
		</dependency>
			
		<dependency>
			<groupId>com.lowagie.text</groupId>
			<artifactId>com.springsource.com.lowagie.text</artifactId>
			<version>2.0.8</version>
			<scope>system</scope>
			<systemPath>${webapp.lib}/com.springsource.com.lowagie.text-2.0.8.jar</systemPath>
		</dependency>
		
		<!-- JAVA Mail (2022.02.24) -->
		<!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail -->
	    <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.6.2</version>
        </dependency>
        
        <dependency>
  			<groupId>redis.clients</groupId>
  			<artifactId>jedis</artifactId>
  			<version>2.9.0</version>
  			<scope>system</scope>
			<systemPath>${webapp.lib}/jedis-2.9.0.jar</systemPath>
 		</dependency>
  </dependencies>
</project>

 

2. 붙여넣기 했으면, [프로젝트 오른쪽 클릭] - [Maven] - [Update Project...]을 눌러서 Maven Update를 진행한다.

 

2022.11.08 - [IT/이클립스(Eclipse)] - [이클립스/Eclipse] 이클립스(Eclipse) Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializer 문제 해결 방법

 

[이클립스/Eclipse] 이클립스(Eclipse) Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializ

pom.xml에서 각 dependency를 채워 넣고, maven 업데이트를 했는데 이제부터 오류 해결하기 시작이다. 이번 에러는 아래와 같다. Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializer maven의

yongku.tistory.com

2022.11.08 - [IT/이클립스(Eclipse)] - [이클립스/Eclipse] 이클립스(Eclipse) Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:mav..

 

[이클립스/Eclipse] 이클립스(Eclipse) Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plu

이클립스(Eclipse)의 자바 프로젝트를 Maven 프로젝트로 변환해서 라이브러리를 pom.xml에서 관리하려고 Maven 프로젝트를 변한하고 Maven Update를 했더니 아래와 같은 에러가 발생했다. Could not calculate bu

yongku.tistory.com

2022.11.08 - [IT/이클립스(Eclipse)] - [이클립스/Eclipse] 이클립스(Eclipse) Project configuration is not up-to-date with pom.xml. Select: Maven->Update Project... from the project context menu or use Quick Fix. 문제 해결 방법

 

[이클립스/Eclipse] 이클립스(Eclipse) Project configuration is not up-to-date with pom.xml. Select: Maven->Update Project

2022.11.08 - [IT/이클립스(Eclipse)] - [이클립스/Eclipse] 이클립스(Eclipse) Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializer 문제 해결 방법 [이클립스/Eclipse] 이클립스(Eclipse) Could not initial

yongku.tistory.com

 

Maven Update 하는데 발생했던 문제들을 모아놨다. 참고하면서 에러를 잡으면 된다.

 

* Spring 3.0에서 Spring 4.0으로 올리면서, IBatis를 MyBatis 라이브러리를 교체했다. 중간 에러도 여기에 기록한다. *

 

https://yongku.tistory.com/entry/%EC%9D%B4%ED%81%B4%EB%A6%BD%EC%8A%A4Eclipse-%EC%9D%B4%ED%81%B4%EB%A6%BD%EC%8A%A4Eclipse-Result-Maps-collection-already-contains-value-for-CommonUserMap-%EB%AC%B8%EC%A0%9C-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95

 

[이클립스/Eclipse] 이클립스(Eclipse) Result Maps collection already contains value for Common.UserMap 문제 해결 방

IBatis를 MyBatis로 바꾸면서 톰캣 WAS를 켤 때마다 xml 에러가 계속 발생하고 있다. 그 중에서도 Result Maps collection already contains value for Common.UserMap 이 에러가 발생한다. Result Maps collection already contains va

yongku.tistory.com

https://yongku.tistory.com/entry/%EC%9D%B4%ED%81%B4%EB%A6%BD%EC%8A%A4Eclipse-%EC%9D%B4%ED%81%B4%EB%A6%BD%EC%8A%A4Eclipse-Attribute-type-is-required-and-must-be-specified-for-element-type-resultMap-%EB%AC%B8%EC%A0%9C-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95

 

[이클립스/Eclipse] 이클립스(Eclipse) Attribute "type" is required and must be specified for element type "resultMap".

IBatis를 MyBatis로 라이브러리를 바꾸면서 아래의 태그에서 에러가 발생했다. 에러 내용은 아래와 같다. Attribute "type" is required and must be specified for element type "resultMap". Attribute "type" is required and must be

yongku.tistory.com

 

4. Spring 3.0 프로젝트에 관한 jar나 파일들을 걷어낸다.

Spring 3.0에서 Spring 4.0으로 버전 업그레이드를 하면 Spring 3.0 관련 파일들을 걷어내야 한다. 안걷어내면 아래와 같이 에러가 발생한다. 아래는 해결 방법이다.

 

More than one fragment with the name [spring_web] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering.

More than one fragment with the name [spring_web] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering.

https://yongku.tistory.com/entry/%EC%9D%B4%ED%81%B4%EB%A6%BD%EC%8A%A4Eclipse-%EC%9D%B4%ED%81%B4%EB%A6%BD%EC%8A%A4Eclipse-More-than-one-fragment-with-the-name-springweb-was-found-This-is-not-legal-with-relative-ordering-See-section-822-2c-of-the-Servlet-specification-for-details-Consider-using-absolute-ordering-%EB%AC%B8%EC%A0%9C-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95

 

[이클립스/Eclipse] 이클립스(Eclipse) More than one fragment with the name [spring_web] was found. This is not legal with

Spring 3.0에서 4.0으로 올리면서 아래의 문제가 발생했다. 나도 스프링 전체에 대한 버전 업그레이드는 처음하는 것이라 문제가 계속 발생한다. More than one fragment with the name [spring_web] was found. This is

yongku.tistory.com

 

5. dbcp 관련 class를 수정한다.

dbcp를 dbcp 2로 바꾸면서, 클래스를 org.apache.commons.dbcp.BasicDataSource에서 org.apache.commons.dbcp2.BasicDataSource로 바꾸면 된다.

 

1) dbcp 1.X 버전

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
</bean>

 

2) dbcp 2.X 버전

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
</bean>

 

6. xml Spring 버전 변경

servlet.xml이나 다른 xml에서 아래와 같이, 스프링 프레임워크에 대한 버전을 바꿔줘야 한다.

 

1) Spring 3.0

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

 

2) Spring 4.0

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	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/aop 
	   http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">

 

7. mybatis-config.xml 추가

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
	<settings>
	  <setting name="cacheEnabled" value="false"/>
	  <setting name="useGeneratedKeys" value="false"/>
	  <setting name="mapUnderscoreToCamelCase" value="true"/>
	  <setting name="callSettersOnNulls" value="true"/>
	  <setting name="defaultStatementTimeout" value="600000"/> <!-- Milliseconds -->
      <setting name="logImpl" value="LOG4J"/>
	</settings>
	<typeAliases>
		<typeAlias alias="DataMap" type="com.common.bean.DataMap" />
		<typeAlias alias="StringMap" type="com.common.util.StringMap" />
	</typeAliases>
</configuration>

 

8. web.xml에서 버전 바꾸기

맨 뒤의 2.4를 3.0으로 바꾼다.

 

1) Spring 3.0

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://JAVA.sun.com/xml/ns/j2ee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_ID" version="2.4">

 

2) Spring 4.0

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://JAVA.sun.com/xml/ns/j2ee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

 

대충 이 정도로 진행하면 Spring 4.0으로 버전 업그레이드가 됐다.

이제 로그 쪽 보러 간다.

감사하다.


참고 자료

https://mongdal.tistory.com/16

반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기