Error creating bean with name 'sqlMapClient' defined in class

项目中报如下的错误,当时依照错误提示很是不解:

Caused by: org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.huawei.support.dao.DaoManager com.huawei.support.attachment.dao.AttachmentDAO.mDaoManager;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoManager':
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.
BeanCreationException: Could not autowire method:
public void com.huawei.support.dao.DaoManager.setSqlMap(com.ibatis.sqlmap.client.SqlMapClient);
nested exception is org.springframework.beans.factory.
BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class
path resource [applicationContext.xml]: Invocation of init method failed; nested exception is
org.springframework.core.NestedIOException: Failed to parse config resource: class path resource
[sql-map-config.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML.
Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.
Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'.
Cause: com.ibatis.sqlmap.client.SqlMapException: Error. Could not initialize class. Cause: java.lang.ClassNotFoundException: ILoginLogDTO at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:507)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
... 37 more

(1) 如上的错误提示,没有发现该类。但是日志中所提到的类存在的。如是就想是不是我创建一个DTO的javabean 时需某一配置文件中配置,让其注册。但是找项目的配置文件时查找类似其它DTO类时没有发现什么配置。
(2) 后来进一步的查找如下的错误提示引起了注意:

Cause: com.ibatis.sqlmap.client.SqlMapException: Error.
Could not initialize class.
Cause: java.lang.ClassNotFoundException: ILoginLogDTO

此时怀疑是不是在Ibatis的配置文件中新加的SQL引进了错误。如是删掉了刚刚添加的SQL发现,Webservice启动正常。如是定位出使新加的SQL引进的问题的。新加的SQL如下所示:
	
<!-- 向 登录日志表SUP_USER_LOGIN_LOG中插入数据 -->
<!--Update by R09559 for version on date begin -->
<insert id="insertLoginInfo" parameterClass="ILoginLogDTO">
<![CDATA[
INSERT INTO SUP_USER_LOGIN_LOG
(USERID,
LOGINTIME,
ACCOUNT_TYPE,
LOGIN_IP
)
VALUES
(#USERID#,
to_date(#LOGINTIME#,'yyyy-MM-dd'),
#ACCOUNT_TYPE#,
#LOGIN_IP#
)
]]>
</insert>
<!--Update by R09559 for version date end -->


(3)最后经过分析发现 parameterClass="ILoginLogDTO" 在配置文件中并没有这样的一个别名,它是对应到一个类的。由于没有配置导致Server在解析配置文件时无法识别该类,而导致Cause: java.lang.ClassNotFoundException: ILoginLogDTO
(4)最终的修改意见是
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值