인프런 커뮤니티 질문&답변

Lannister님의 프로필 이미지
Lannister

작성한 질문수

3. 웹개발 코스 [Enterprise Architecture(EA) X 전자정부프레임워크]

제6강#0 아키텍처 및 데이터베이스와 데이터교환

6강 따라하다가 에러 발생했습니다!

작성

·

1.3K

0

2023-06-20 23:01:59,508 INFO [org.springframework.web.context.ContextLoader] Root WebApplicationContext: initialization started

2023-06-20 23:02:00,929 DEBUG [org.egovframe.rte.fdl.cmmn.aspect.ExceptionTransfer] count of ExceptionHandlerServices = 2

2023-06-20 23:02:01,382 DEBUG [org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl] [Properties Service] 프로퍼티 key = pageUnit, 값 = 10 은 이 설정파일에 정의되어 있습니다.

2023-06-20 23:02:01,382 DEBUG [org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl] [Properties Service] 프로퍼티 key = pageSize, 값 = 10 은 이 설정파일에 정의되어 있습니다.

2023-06-20 23:02:01,479 WARN [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in file [C:\eGovFrame\eGovFrameDev-4.1.0-64bit\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Egov_WEB\WEB-INF\classes\egovframework\spring\context-sqlMap.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [egovframework/sqlmap/example/sql-map-config.xml] cannot be opened because it does not exist

2023-06-20 23:02:01,482 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in file [C:\eGovFrame\eGovFrameDev-4.1.0-64bit\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Egov_WEB\WEB-INF\classes\egovframework\spring\context-sqlMap.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [egovframework/sqlmap/example/sql-map-config.xml] cannot be opened because it does not exist

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:934) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.20.jar:5.3.20]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.20.jar:5.3.20]

at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) ~[spring-web-5.3.20.jar:5.3.20]

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) ~[spring-web-5.3.20.jar:5.3.20]

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) ~[spring-web-5.3.20.jar:5.3.20]

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4494) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4946) ~[catalina.jar:9.0.76]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1328) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1318) ~[catalina.jar:9.0.76]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:9.0.76]

at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) ~[?:?]

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:795) ~[catalina.jar:9.0.76]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1328) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1318) ~[catalina.jar:9.0.76]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:9.0.76]

at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) ~[?:?]

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:249) ~[catalina.jar:9.0.76]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428) ~[catalina.jar:9.0.76]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.76]

at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:923) ~[catalina.jar:9.0.76]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[catalina.jar:9.0.76]

at org.apache.catalina.startup.Catalina.start(Catalina.java:772) ~[catalina.jar:9.0.76]

at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347) ~[bootstrap.jar:9.0.76]

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478) ~[bootstrap.jar:9.0.76]

Caused by: java.io.FileNotFoundException: class path resource [egovframework/sqlmap/example/sql-map-config.xml] cannot be opened because it does not exist

at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:199) ~[spring-core-5.3.20.jar:5.3.20]

at org.egovframe.rte.psl.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:346) ~[org.egovframe.rte.psl.dataaccess-4.1.0.jar:?]

at org.egovframe.rte.psl.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:301) ~[org.egovframe.rte.psl.dataaccess-4.1.0.jar:?]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.20.jar:5.3.20]

... 42 more

답변 4

1

개발자Park님의 프로필 이미지
개발자Park
지식공유자

안녕하세요.개발자park입니다.

[로그내용]

Error creating bean with name 'sqlMapClient' defined in file [C:\eGovFrame\eGovFrameDev-4.1.0-64bit\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Egov_WEB\WEB-INF\classes\egovframework\spring\context-sqlMap.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [egovframework/sqlmap/example/sql-map-config.xml] cannot be opened because it does not exist

 

[원인]

네 예측하신대로 이전 강의에서 해당 파일을 삭제해서 그렇습니다.

https://www.inflearn.com/course/lecture?courseSlug=%EC%9B%B9%EA%B0%9C%EB%B0%9C-%EC%BD%94%EC%8A%A4-ea-%EC%A0%84%EC%9E%90%EC%A0%95%EB%B6%80-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC&unitId=155003&tab=curriculum

 

5강29:06처럼 해당"sqlMapClient" bean이 위치한 파일을 삭제도 같이해야 문제가 없을 것 입니다.

감사합니다.

Lannister님의 프로필 이미지
Lannister
질문자

 

image오우 늦은시간에 감사합니다..

삭제도 따라했었는데.. context-sqlMap.xml 삭제

그래도 에러가 생깁니다!

개발자Park님의 프로필 이미지
개발자Park
지식공유자

[원인]

보시면 로그에 동일하게 Error creating bean with name 'sqlMapClient'이 나옵니다.

즉 삭제하신(변경) 사항이 반영이 안된 것으로 보입니다.

[해결방법]

톰캣 서버를 중지->CTRL+B키로 빌드해주세요.(톰캣서버에서 사용할 실행파일 생성)->톰캣 서버를 다시 시작해보시길 바랍니다.

 

 

Lannister님의 프로필 이미지
Lannister
질문자

감사합니다. 초반엔 분명 ctrl + B키가 빌드 잘 됐었는데.. 갑자기 어느 순간부터 안되네요.

일단. 프로젝트 클린 / 톰켓 디렉토리 클린 / 톰캣 클린 해서 다음 에러 단계로 넘어갔습니다!

2023-06-21 00:33:03,852 WARN [org.mariadb.jdbc.message.server.ErrorPacket] Error: 1049-42000: Unknown database 'tbl_user'

image

 

개발자Park님의 프로필 이미지
개발자Park
지식공유자

https://www.inflearn.com/course/lecture?courseSlug=%EC%9B%B9%EA%B0%9C%EB%B0%9C-%EC%BD%94%EC%8A%A4-ea-%EC%A0%84%EC%9E%90%EC%A0%95%EB%B6%80-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC&unitId=155003&tab=curriculum

 

5강 24:43에서 데이터베이스 이름이 아니라 테이블 이름이 복사된 것으로 보입니다.

다시 한번 확인해보시기를 권장드립니다.

Lannister님의 프로필 이미지
Lannister
질문자

세상에나.........................

감사합니다 잘 됐습니다 ㅠㅠㅠ 너무감사드려요 1배속으로 들어야겠네요 이번주 완강 목표로해서 빨리빨리 하려다보니 뭔가 실수가 많네요... 감사합니다!!!!

0

sqlmap 관련 오류 뜨시는분들은 .metadata를 지우는것도 시도해보시면 좋을 것 같습니다.

프로젝트 클린, 톰켓 클린 다 안먹어서 폴더에 있는 캐시와 기본설정 데이터인 .metadata 전체를 날려버리고 tomcat부터 maven까지 다시 설치했더니 정상작동했습니다.

비슷한 증상이 있는데 해결 안되셨던 분들은 한번 시도해보세요!

0

Lannister님의 프로필 이미지
Lannister
질문자

이전 강의에서 (5강 - 28:39 ~ ) /Egov_WEB/src/main/resources/egovframework/sqlmap

안의 내용을 지워서 생기는 오류인 것 같기도하고.. 질문드립니다 ㅠㅠ 톰캣 재시작만 해도 저 오류가 발생하네요. 따로 저

0

Lannister님의 프로필 이미지
Lannister
질문자

Error creating bean with name 'sqlMapClient' defined in file [C:\eGovFrame\eGovFrameDev-4.1.0-64bit\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Egov_WEB\WEB-INF\classes\egovframework\spring\context-sqlMap.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [egovframework/sqlmap/example/sql-map-config.xml] cannot be opened because it does not exist

Lannister님의 프로필 이미지
Lannister

작성한 질문수

질문하기