created a ThreadLocal with key of type [oracle.jdbc.driver.AutoKeyInfo$1]
环境:
spring4.3, mybatis3.5.2, ojdbc8_8c(oracle 18c jdbc)
调试状态下退出时,提示:
严重 [main] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [oracle.jdbc.driver.AutoKeyInfo$1] (value [oracle.jdbc.driver.AutoKeyInfo$1@10289886]) and a value of type [oracle.jdbc.driver.OracleSql] (value [INSERT INTO 某表 (某字段1, 某字段1)
VALUES (?, ?)]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
看提示是个插入语句,此表有主键,为整型,没有使用序列,自己生成的一个数值
警告信息中,AutoKeyInfo来源于: package oracle.jdbc.driver (class AutoKeyInfo extends OracleResultSetMetaData)
分别在以下三块代码中打上断点,以方便查看是哪里调用的
private static final ThreadLocal<OracleSql> SQL_PARSER = new ThreadLocal() {
protected OracleSql initialValue() {
return new OracleSql((DBConversion)null);
}
};
AutoKeyInfo(String var1) {
this.sqlKind = SqlKind.UNINITIALIZED;
this.originalSql = var1;
this.autoKeyType = 0;
}
AutoKeyInfo(String var1, String[] var2) {
this.sqlKind = SqlKind.UNINITIALIZED;
this.originalSql = var1;
this.columnNames = var2;
this.autoKeyType = 1;
}
1. 开始调试,定位到调用处(org\mybatis\mybatis\3.5.2\mybatis-3.5.2-sources.jar!\org\apache\ibatis\executor\statement\PreparedStatementHandler.java),
其中: PreparedStatement.RETURN_GENERATED_KEYS 值 固定为 1 ;

2. 再进入(oracle\oracle-jdbc\18.3\ojdbc8_18c.jar!\oracle\jdbc\driver\PhysicalConnection.class),在此处生成了 AutoKeyInfo对象

上网找AutoKeyInfo对象的作用,没有找到合适的说明,猜测是与表自增长字段有关的,但此处不需要自增长,想着在第1步有分支【if (keyColumnNames == null)】
,如果keyColumnNames不为null,走 connection.prepareStatement(sql, keyColumnNames)会不会产生AutoKeyInfo了?
3. 打开mybatis官网(我是访问的中文: https://mybatis.org/mybatis-3/zh/sqlmap-xml.html#insert_update_and_delete)
找到 insert, update 和 delete部分,看到keyColumn属性,在自己业务层面 dao.xml对应语句的地方,加上: keyColumn = "字段1",再调试
4. 进入到

5. 还是走到了第2步,试着在第3步 keyColumn = "字段1" 再加上 useGeneratedKeys="false", 官网上说明 false是默认值,不设置应该就采用false,但想着加上试一下

6. 进入(connection.prepareStatement(sql)):

此次没有再创建 AutoKeyInfo,退出程序,也没有发现警告信息了
created a ThreadLocal with key of type [oracle.jdbc.driver.AutoKeyInfo$1]的更多相关文章
- tomcat加载时报The web application [/dmscs] created a ThreadLocal with key of type
严重: The web application [/dmscs] created a ThreadLocal with key of type [com.opensymphony.xwork2.inj ...
- The web application [/struts2_0100] created a ThreadLocal with key of type
引用: 严重: The web application [/struts2_0100] created a ThreadLocal with key of type [com.opensymphony ...
- 错误:created a ThreadLocal with key of type ……but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
tomcat reload显示错误:SEVERE: The web application [/Interceptor] created a ThreadLocal with key of type ...
- Class org.apache.struts2.json.JSONWriter can not access a member of class oracle.jdbc.driver.Physica
产生这个错误的原因是因为我的oracle数据库中有一个CLOB字段,查询出来的时候要转换为JSON而报错. Class org.apache.struts2.json.JSONWriter can n ...
- Maven魔法堂:安装Oracle JDBC Driver依赖的那些坑
前言 由于Oracle并没有向公开Maven仓库提供任何Oracle JDBC Driver的Jar包,因此我们无法像MySQL.SQLite等那么轻松直接通过Maven加载依赖. 而手动下载Orac ...
- java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver 错误的解决办法
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver 错误的解决办法 (2011-05-05 16:08:05) 转载▼ ...
- myeclipe eclipse 常遇问题:Some projects cannot be imported 、java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver、The file connot be validate
1.Some projects cannot be imported because they already exist in the workspace 2.Some projects were ...
- 关于Class.forName("oracle.jdbc.driver.OracleDriver");报ClassNotFoundException 的异常
关于try { Class.forName("oracle.jdbc.driver.OracleDriver"); }catch(ClassNotFoundException e) ...
- 【转】Install Oracle Jdbc driver in your Maven local repository
Install Oracle Jdbc driver in your Maven local repository If you are using Oracle, you must first in ...
随机推荐
- Linux系统的发展历史和学习前景介绍
2020年了,我想来跟大家聊聊Linux运维这一行业,从几个方面说下行业的现状.如何学好Linux和如何成为专业运维人员以及云服务对于Linux运维的影响. 一.linux行业状况 我们都知道从199 ...
- gcd && exgcd算法
目录 欧几里德算法与扩展欧几里德算法 1.欧几里德算法 2.扩展欧几里德算法 欧几里德算法与扩展欧几里德算法 1.欧几里德算法 #include<bits/stdc++.h> using ...
- Android之收音机UI实现(转)
源码: http://www.2cto.com/kf/201211/171417.html 最近在研究收音机的源码,本来想把收音机从源码中提取出来,做成一个单独的应用,但是,收音机需要底层的支持,所以 ...
- Linux CentOS7 VMware LAMP架构Apache用户认证、域名跳转、Apache访问日志
一.Apache用户认证 vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf //把111.com那个虚拟主机编辑成如下内容 <Virtu ...
- 浅谈脱壳中的附加数据问题(overlay)
Author:Lenus -------------------------------------------------- 1.前言 最近,在论坛上看到很多人在弄附加数据overlay的问题,加上 ...
- 分段控制器UISegmentedControl的使用、同一个控制器中实现多个View的切换、addChildViewController等方法的使用
本文先讲解简单的分段控制器UISegmentedControl的使用,然后具体讲解它最常使用的场景:同一个控制器中实现多个View的切换. 文章构思: 1.先直接讲解一张UI效果图的四种实现方式. 2 ...
- Lesson 10 Silicon valley
What does the computer industry thrive on apart from anarchy? Technology trends may push Silicon Val ...
- Numpy中 arange() 的用法
1. 概述Numpy 中 arange() 主要是用于生成数组,具体用法如下: 2. arange()2.1 语法numpy.arange(start, stop, step, dtype = Non ...
- 第1节 kafka消息队列:5、javaAPI操作
8.kafka的API 详见代码 第一步:导入kafka的开发jar包 Kafka生产者 Kafka消费者
- 在线配置raid
Exit Code: 0x00 rpm -ivh MegaCli-8.07.14-1.noarch.rpm ls /opt/MegaRAID/MegaCli//opt/MegaRAID/MegaCli ...