다중 DB 설정
- 작성자 :
- 정*선
- 작성일 :
- 2010-12-24 16:21:10
- 조회수 :
- 3,087
- 구분 :
- 실행환경
- 진행상태 :
- 완료
Q
다른 분 질문에 대한 답변 내용처럼 했는데 ㅠㅠ
다중 DB라 첨부한 파일을 보시면 아시겠지만 context-datasource에 두 개의 datasource를 설정하구 context-sqlMap.xml을 다른 이름으로 하나 추가한 후 새로운Dao도 생성했는데 아래와 같은 오류가 발생합니다.
제 개인적인 생각으로는 SqlMapClientFactoryBean에는 dataSource라는 필드만 있지 새로운 id인 smsDataSoruce라는 필드가 없어서 오류가 나는 것 같은데 해결 방법이 없을까요?
아래는 오류 메시지입니다.
Error creating bean with name 'tbSmsInfoDAO': Injection of resource methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'smsSqlMapClient' defined in file [D:\kemco\workspace\tmss\target\classes\egovframework\spring\context-sqlMap-sms.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'smsDataSource' of bean class [org.springframework.orm.ibatis.SqlMapClientFactoryBean]: Bean property 'smsDataSource' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
다중 DB라 첨부한 파일을 보시면 아시겠지만 context-datasource에 두 개의 datasource를 설정하구 context-sqlMap.xml을 다른 이름으로 하나 추가한 후 새로운Dao도 생성했는데 아래와 같은 오류가 발생합니다.
제 개인적인 생각으로는 SqlMapClientFactoryBean에는 dataSource라는 필드만 있지 새로운 id인 smsDataSoruce라는 필드가 없어서 오류가 나는 것 같은데 해결 방법이 없을까요?
아래는 오류 메시지입니다.
Error creating bean with name 'tbSmsInfoDAO': Injection of resource methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'smsSqlMapClient' defined in file [D:\kemco\workspace\tmss\target\classes\egovframework\spring\context-sqlMap-sms.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'smsDataSource' of bean class [org.springframework.orm.ibatis.SqlMapClientFactoryBean]: Bean property 'smsDataSource' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
첨부파일
A
안녕하세요.. 정영선님..
context-sqlMap-sms.xml의 smsSqlMapClient의 속성에 사용된 이름(smsDataSource) 때문입니다.
다음과 같이 수정 (smsDataSource => dataSource)하시면 됩니다.
<bean id="smsSqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:/egovframework/sqlmap/rte/sql-map-config.xml"/>
<property name="dataSource" ref="smsDataSource"/>
</bean>
그럼.. 즐거운 하루되십시오.
감사합니다.
context-sqlMap-sms.xml의 smsSqlMapClient의 속성에 사용된 이름(smsDataSource) 때문입니다.
다음과 같이 수정 (smsDataSource => dataSource)하시면 됩니다.
<bean id="smsSqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:/egovframework/sqlmap/rte/sql-map-config.xml"/>
<property name="dataSource" ref="smsDataSource"/>
</bean>
그럼.. 즐거운 하루되십시오.
감사합니다.