표준프레임워크에서 배치 운영환경에서 DBCP 1.x를 2.x 이상으로 업그레이드할 시 에러가 난다.
테스트 조건.
1. 표준프레임워크 교육교재 3.7.0 에서 배치운영환경 3.7.0 import
2. 프로젝트 JDK 1.8 (Compiled)/ tomcat 8.0 / servlet 2.5
3. MySQL bopr 데이터베이스 이용 / mysql-connector-5.1.31.jar 사용 (https://dev.mysql.com/doc/relnotes/connector-j/5.1/en/news-5-1-31.html#connector-j-5-1-31-bug)
4. http://www.egovframe.go.kr/wiki/doku.php?id=egovframework:bopr:%EC%84%A4%EC%B9%98 메뉴얼에 따라 수행
- 업로드 전 기존 프로젝트 import 시 정상구동 확인
- 테스트 표준
1) DBCP > DBCP 2 변경
이 상태에서 구동 시 아래와 같은 로그 발생
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource-mysql' defined in file [C:\eGovFrame-3.7.0\workspace.edu\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\bopr\WEB-INF\classes\egovframework\spring\com\context-datasource.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
......................
......................
......................
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodSecurityMetadataSources' defined in URL [jar:file:/C:/eGovFrame-3.7.0/workspace.edu/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bopr/WEB-INF/lib/egovframework.rte.fdl.security-3.7.0.jar!/META-INF/spring/security/method-config.xml]: Cannot resolve reference to bean 'methodMap' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodMap' defined in URL [jar:file:/C:/eGovFrame-3.7.0/workspace.edu/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bopr/WEB-INF/lib/egovframework.rte.fdl.security-3.7.0.jar!/META-INF/spring/security/method-config.xml]: Cannot resolve reference to bean 'securedObjectService' while setting bean property 'securedObjectService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securedObjectService' defined in URL [jar:file:/C:/eGovFrame-3.7.0/workspace.edu/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bopr/WEB-INF/lib/egovframework.rte.fdl.security-3.7.0.jar!/META-INF/spring/security/security-config.xml]: Cannot resolve reference to bean 'securedObjectDAO' while setting bean property 'securedObjectDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securedObjectDAO' defined in URL [jar:file:/C:/eGovFrame-3.7.0/workspace.edu/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bopr/WEB-INF/lib/egovframework.rte.fdl.security-3.7.0.jar!/META-INF/spring/security/security-config.xml]: Cannot resolve reference to bean 'dataSourceFactoryBean' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceFactoryBean': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource-mysql' defined in file [C:\eGovFrame-3.7.0\workspace.edu\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\bopr\WEB-INF\classes\egovframework\spring\com\context-datasource.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
......................
......................
Caused by: java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
2) context-datasource.xml에서
각 dataSource-*(mysql,altibase,tibero,oracle,cubrid) 의 클래스를
org.apache.commons.dbcp.BasicDataSource > org.apache.commons.dbcp2.BasicDataSource
로 변경해서 정상 작동.
결론 : pom.xml과 context-datasource.xml에 정확한 선언하면 배치운영환경은 was에서 프로젝트 정상 기동.
2.0 이상 사용 시 각 jdbc와 jdk 버전 확인 필요.
참고.
DBCP 버전별 홈페이지 요구 스펙
DBCP 2.6.0 compiles and runs under Java 8 only (JDBC 4.2)
DBCP 2.5.0 compiles and runs under Java 8 only (JDBC 4.2)
DBCP 2.4.0 compiles and runs under Java 7 only (JDBC 4.1)
DBCP 1.4 compiles and runs under Java 6 only (JDBC 4)
DBCP 1.3 compiles and runs under Java 1.4-5.0 only (JDBC 3)
*https://commons.apache.org/proper/commons-dbcp/index.html'
DBCP 버전 | JDK | JDBC |
2.5 이상 | 1.8 | 4.2 |
2.0 ~2.4 | 1.7 | 4.1 |
1.4 | 1.6 | 4 |
1.3 이하 | 1.4~1.5 | 3 |
maven 설정 (dbcp2.0 사용 시) 아래에서 버전 선택해서 선언하면됨
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.* or 2.*.0 </version>
</dependency>
'표준프레임워크_eGovFrame > 운영환경' 카테고리의 다른 글
표준프레임워크 eGovFrame 3.7 배치 운영환경 (MacOS) MySQL ERROR "this is incompatible with sql_mode=only_full_group_by" (0) | 2019.07.08 |
---|