项目中报如下的错误,当时依照错误提示很是不解:
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)最终的修改意见是
分享到:
相关推荐
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation"> <value>classpath:SqlMapConfig.xml </bean> <bean id="dao" class="org....
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="configLocation"> <value>classpath:...
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" p:dataSource-ref="dataSourceProxy"> <property name="configLocation"> <value>classpath:SqlMapConfig.xml...
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation"> <value>classpath:ibatis-Base.xml <property name="dataSource"> <ref ...
。。。
。。。
Class.forName("org.hsqldb.jdbcDriver"); System.out.println("Driver Loaded."); // Establish the connection to the database. String url = "jdbc:hsqldb:data/tutorial"; Connection conn = ...
包含SqlMapClient里全部方法的介绍,附带了数据库,绝对的原创,本资源绝对的免费 /* * 带参数的queryForMap用法 */ @SuppressWarnings("unchecked") public Map queryForMap(String sql_name, Object ...
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 ...
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 ...
private static SqlMapClient sqlMapClient = null; static { try { Reader reader = com.ibatis.common.resources.Resources.getResourceAsReader("com/itcast/SqlMapConfig.xml"); sqlMapClient = ...
public class EmployeeDAO { private static SqlMapClient sqlMapper; static { try { Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml"); sqlMapper = SqlMapClientBuilder....
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. 把...
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 ...
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 ...
16 SqlMapClient ........................................................................................... 16 SqlMapClient 基本操作示例..........................................................
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 ...
用SqlMapClient执行SQL语句 代码例子 例子1:执行update(insert,update,delete) 例子2:查询成对象(select) 例子3:用预赋值的结果对象查询成对象(select) 例子4:查询成对象List(select) 例子5:自动提交...
SqlMapClient对象是iBATIS中的主要对象,我们可以通过配置让spring来管理SqlMapClient对象的创建。 与hibernate类似,Spring 提供了SqlMapClientDaoSupport对象,我们的DAO可以继承这个类,通过它所提供的...
ibatis API参考文档,用于查询ibatis框架中所用到的类和方法,包括主要对象sqlMapClient等