`
wkf41068
  • 浏览: 452602 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

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)最终的修改意见是
分享到:
评论

相关推荐

    Spring高版本对ibatis的支持

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;property name="configLocation"&gt; &lt;value&gt;classpath:SqlMapConfig.xml &lt;/bean&gt; &lt;bean id="dao" class="org....

    SSI框架整合实例

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;property name="configLocation"&gt; &lt;value&gt;classpath:...

    spring applicationContext 配置文件

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" p:dataSource-ref="dataSourceProxy"&gt; &lt;property name="configLocation"&gt; &lt;value&gt;classpath:SqlMapConfig.xml...

    springmvc-ibatis

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;property name="configLocation"&gt; &lt;value&gt;classpath:ibatis-Base.xml &lt;property name="dataSource"&gt; &lt;ref ...

    SqlMapClient对象.pdf

    。。。

    SqlMapClient对象.docx

    。。。

    iBatis-设置缓存模式-Java源码(下载)

    Class.forName("org.hsqldb.jdbcDriver"); System.out.println("Driver Loaded."); // Establish the connection to the database. String url = "jdbc:hsqldb:data/tutorial"; Connection conn = ...

    ibatis例子=》包含了常用方法介绍

    包含SqlMapClient里全部方法的介绍,附带了数据库,绝对的原创,本资源绝对的免费 /* * 带参数的queryForMap用法 */ @SuppressWarnings("unchecked") public Map queryForMap(String sql_name, Object ...

    Spring中文帮助文档

    2.3.3. 对bean命名pointcut( bean name pointcut element)的支持 2.3.4. 对AspectJ装载时织入(AspectJ load-time weaving)的支持 2.4. 中间层 2.4.1. 在XML里更为简单的声明性事务配置 2.4.2. 对Websphere ...

    Spring API

    2.3.3. 对bean命名pointcut( bean name pointcut element)的支持 2.3.4. 对AspectJ装载时织入(AspectJ load-time weaving)的支持 2.4. 中间层 2.4.1. 在XML里更为简单的声明性事务配置 2.4.2. 对Websphere ...

    传智播客ibatis视频教程源代码

    private static SqlMapClient sqlMapClient = null; static { try { Reader reader = com.ibatis.common.resources.Resources.getResourceAsReader("com/itcast/SqlMapConfig.xml"); sqlMapClient = ...

    ibatis源码 例子

    public class EmployeeDAO { private static SqlMapClient sqlMapper; static { try { Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml"); sqlMapper = SqlMapClientBuilder....

    Spring-Reference_zh_CN(Spring中文参考手册)

    4.3.2. ClassPathResource 4.3.3. FileSystemResource 4.3.4. ServletContextResource 4.3.5. InputStreamResource 4.3.6. ByteArrayResource 4.4. ResourceLoader 4.5. ResourceLoaderAware 接口 4.6. 把...

    Spring.3.x企业应用开发实战(完整版).part2

    7.9 JVM Class文件字节码转换基础知识 7.9.1 java.lang.instrument包的工作原理 7.9.2 如何向JVM中注册转换器 7.9.3 使用JVM启动参数注册转换器的问题 7.10 使用LTW织入切面 7.10.1 Spring的LoadTimeWeaver 7.10.2 ...

    Spring3.x企业应用开发实战(完整版) part1

    7.9 JVM Class文件字节码转换基础知识 7.9.1 java.lang.instrument包的工作原理 7.9.2 如何向JVM中注册转换器 7.9.3 使用JVM启动参数注册转换器的问题 7.10 使用LTW织入切面 7.10.1 Spring的LoadTimeWeaver 7.10.2 ...

    ibatis 开发指南(pdf)

    16 SqlMapClient ........................................................................................... 16 SqlMapClient 基本操作示例..........................................................

    IBATIS实用记录

    3.3 SQLMAPCLIENT基本操作示例 6 3.3.1 数据写入操作(insert, update, delete) 6 3.3.2 数据查询 (select) 7 3.3.3 在指定对象中存放查询结果(select) 7 3.3.4 执行批量查询 (select) 7 3.3.5 关于AutoCommit 7 ...

    iBatis SQL Maps开发指南.pdf

    用SqlMapClient执行SQL语句 代码例子 例子1:执行update(insert,update,delete) 例子2:查询成对象(select) 例子3:用预赋值的结果对象查询成对象(select) 例子4:查询成对象List(select) 例子5:自动提交...

    ibatis与Spring整合例子

    SqlMapClient对象是iBATIS中的主要对象,我们可以通过配置让spring来管理SqlMapClient对象的创建。 与hibernate类似,Spring 提供了SqlMapClientDaoSupport对象,我们的DAO可以继承这个类,通过它所提供的...

    ibatis API参考文档

    ibatis API参考文档,用于查询ibatis框架中所用到的类和方法,包括主要对象sqlMapClient等

Global site tag (gtag.js) - Google Analytics