WebLogic 数据源连接泄露

编码时,有时会忘记释放使用的数据源连接,造成连接泄露,没有连接资源可用。

现象

java.sql.SQLException: Cannot obtain XAConnection
        at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1691)
        at weblogic.jdbc.jta.DataSource.getConnectionInternal(DataSource.java:523)
        at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:500)
        at weblogic.jdbc.common.internal.WLDataSourceImpl.getConnectionInternal(WLDataSourceImpl.java:631)
        at weblogic.jdbc.common.internal.WLDataSourceImpl.getConnection(WLDataSourceImpl.java:611)
        at weblogic.jdbc.common.internal.WLDataSourceImpl.getConnection(WLDataSourceImpl.java:604)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:108)
        at TastyList.doGet(TastyList.java:46)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:250)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3793)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3763)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)
        at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
        at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
        at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2451)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2299)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2277)
        at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1720)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1680)
        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
        at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
        at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
        at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
        at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
        at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)
Caused by: java.sql.SQLException: weblogic.common.resourcepool.ResourceLimitException: No resources currently available in pool datasourceXA1 to allocate to applications, please increase the size of the pool and retry..
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResourceInternal(ResourcePoolImpl.java:669)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:378)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:365)
        at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:608)
        at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:521)
        at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:144)
        at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:94)
        at weblogic.jdbc.jta.DataSource.getXAConnectionFromPool(DataSource.java:1938)
        at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1679)
        at weblogic.jdbc.jta.DataSource.getConnectionInternal(DataSource.java:523)
        at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:500)
        at weblogic.jdbc.common.internal.WLDataSourceImpl.getConnectionInternal(WLDataSourceImpl.java:631)
        at weblogic.jdbc.common.internal.WLDataSourceImpl.getConnection(WLDataSourceImpl.java:611)
        at weblogic.jdbc.common.internal.WLDataSourceImpl.getConnection(WLDataSourceImpl.java:604)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:108)
        at TastyList.doGet(TastyList.java:46)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:250)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3793)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3763)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)
        at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
        at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
        at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2451)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2299)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2277)
        at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1720)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1680)
        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
        at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
        at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
        at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
        at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
        at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)

        at weblogic.jdbc.jta.DataSource.getXAConnectionFromPool(DataSource.java:1982)
        at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1679)
        ... 33 more

重点log:
明确那个数据源发生了连接泄露

Caused by: java.sql.SQLException: weblogic.common.resourcepool.ResourceLimitException: No resources currently available in pool xxxx to allocate to applications, please increase the size of the pool and retry.

明确在哪个文件中使用了数据源连接没有释放

at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:108)
at TastyList.doGet(TastyList.java:46) --->使用数据源连接的地方,一般是调用DataSource.getConnection()方法的地方
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

解决方法

不重启weblogic,让weblogic 自动回收
weblogic console->Services->Data Sources->log中已明确的数据源->Configuration->Connection Pool->Advanced中
在这里插入图片描述
当然最根本的办法是,根据log提示,DataSource.getConnection()后,及时close连接。
例如:
在这里插入图片描述

自动收集连接泄露

weblogic console->Services->Data Sources->数据源->Configuration ->Diagnostics
开启连接泄露的收集以及设定收集间隔时间。
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/558199.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

ssm062会员管理系统+jsp

会员管理系统 摘 要 随着科学技术的飞速发展,各行各业都在努力与现代先进技术接轨,通过科技手段提高自身的优势;对于会员管理系统当然也不能排除在外,随着网络技术的不断成熟,带动了会员管理系统,它彻底改…

Java项目引入log4j2

log4j2 单独使用 引入依赖 <dependencies><dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-api</artifactId><version>2.14.0</version></dependency><dependency><groupId>o…

[管理者与领导者-174] :人际网络-1- 网络概述,是由一个个人组成的网络,每个节点是“人”

目录 一、数据通信网络 二、移动通信网络 三、人际网络 四、计算机网络与人际网络的比较 五、人际网络中节点-人的分层架构 5.1 人&#xff08;节点&#xff09;的分层架构&#xff1a;个体生理、个体心理、人际关系、社会功能 5.2 什么是人性 5.3 人性的特点 5.3 人性…

智能化新浪潮:国产智能体势在必行,一探究竟!

回顾之前的文章 GPTs大爆发&#xff1a;我的智能助手累计使用71k&#xff0c;荣登全球排名79&#xff0c;我们已经见证了智能助手的强劲增长势头。今天&#xff0c;我兴奋地分享一个新的里程碑&#xff1a;我的GPTs使用量已经突破10万次&#xff0c;排名再次提升&#xff01; 接…

盲人出行新助手:无障碍技术的进步

作为一名资深记者&#xff0c;我始终关注着社会弱势群体的生活权益&#xff0c;尤其是对于视障人士这一特殊群体。在科技日新月异的今天&#xff0c;我们欣喜地看到&#xff0c;盲人无障碍设施这一概念正在以更为先进、人性化的形式实现落地&#xff0c;其中&#xff0c;一款名…

与上级意见不合时如何恰当地表达自己的观点?

在工作中与上级意见不合时&#xff0c;恰当表达自己的观点并寻求共识是一个需要谨慎处理的问题。以下是一些建议&#xff1a; 1. **尊重与礼貌**&#xff1a;在任何情况下&#xff0c;都应保持对上级的尊重和礼貌。即使在意见不合时&#xff0c;也要避免情绪化&#xff0c;保持…

简单二分应用

思路&#xff1a;首先二分需要数列有二分性&#xff0c;我们要对数列排序&#xff0c;然后二分距离&#xff0c;直到出现一个距离可以满足&#xff0c;点数大于等于k。 代码&#xff1a; void solve(){int n, q;cin >> n >> q;vector<int>a(n);for(int i …

代码随想录:二叉树11-12

目录 222.完全二叉树的节点个数 题目 代码&#xff08;层序迭代&#xff09; 代码&#xff08;后序递归&#xff09; 代码&#xff08;满二次树递归&#xff09; 总结 110.平衡二叉树 题目 代码&#xff08;后序递归&#xff09; 代码&#xff08;层序迭代&#xff0…

设置表格高度后,数值改变但实际不变

1.选中表格 2.点击“开始”——>“段落设置”的选项启动按钮&#xff0c;设置为单倍行距 3.可以看到&#xff0c;表格的行高被调小了。

如何高效建立企业绩效评估体系?这家世界500强企业用BI工具这么做

在目前经济下行&#xff0c;竞争激烈&#xff0c;向精细化管理要效益的社会背景下&#xff0c;如何对资金结算部门做好绩效管理&#xff0c;以保障组织的正常运作&#xff0c;是各大企业面对的重要痛点。 本文将基于某世界500强公司的财务共享资金结算部门的绩效管理办法&…

河北专升本(c语言各种编程题)

目录 第一类、递归调用 第二类、特殊数字 第三类、多维数组 第四类、字符处理 第五类、数学问题 第六类、排序算法 第七类、循环问题 第八类、进制转换 第九类、实际应用 第十类、图形输出 第一类、递归调用 1.汉诺塔&#xff1a;请输入盘子数&#xff0c;输出盘子移动…

海外媒体如何发布软文通稿

大舍传媒-带您了解海外发布新潮流 随着全球化的不断深入&#xff0c;越来越多的中国企业开始关注海外市场。为了在国际舞台上树立品牌形象&#xff0c;企业纷纷寻求与海外媒体合作&#xff0c;通过发布软文通稿的方式&#xff0c;传递正面信息&#xff0c;提升品牌知名度。作为…

【4071】基于小程序实现的活动报名管理系统

作者主页&#xff1a;Java码库 主营内容&#xff1a;SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、小程序、安卓app等设计与开发。 收藏点赞不迷路 关注作者有好处 文末获取源码 技术选型 【后端】&#xff1a;Java 【框架】&#xff1a;ssm 【…

抹机王的使用教程以及常见问题

首先请确保你已经正常安装了XPosed/EDXP/LSP框架并已激活抹机王模块&#xff0c;其中XP和EDXP模块均只需要框架内激活抹机王并重启即可&#xff0c;LSPosed注意作用域需要勾选上自己想要修改的APP&#xff08;如果你还是一意孤行只勾选系统框架那改机完全没用就是你自己的想法了…

设计模式之模板方法模式详解(下)

3&#xff09;钩子方法的使用 1.概述 钩子方法的引入使得子类可以控制父类的行为。 2.结构图 3.代码实现 将公共方法和框架代码放在抽象父类中 abstract class DataViewer {//抽象方法&#xff1a;获取数据public abstract void GetData();//具体方法&#xff1a;转换数据…

每日一题 — 最小覆盖子串

76. 最小覆盖子串 - 力扣&#xff08;LeetCode&#xff09; 解法一&#xff1a;暴力遍历哈希表 解法二&#xff1a;滑动窗口哈希表 定义left和right初始化为零&#xff0c;固定left&#xff0c;先向右遍历right&#xff0c;放到哈希表中这个时候我们需要统计有效字符的个数&…

深入挖掘C语言 ---- 文件操作

目录 1. 文件的打开和关闭1.1 流和标准流1.1.1流1.1.2标准流 1.2 文件指针1.3 文件的打开和关闭 2. 顺序读写3. 随机读写3.1 fseek3.2 ftell3.3 rewind 4. 读取结束判定 正文开始 1. 文件的打开和关闭 1.1 流和标准流 1.1.1流 我们程序的数据需要输出到各种外部设备, 也需要…

Leetcode算法训练日记 | day30

一、重新安排行程 1.题目 Leetcode&#xff1a;第 332 题 给你一份航线列表 tickets &#xff0c;其中 tickets[i] [fromi, toi] 表示飞机出发和降落的机场地点。请你对该行程进行重新规划排序。 所有这些机票都属于一个从 JFK&#xff08;肯尼迪国际机场&#xff09;出发…

java算法day2

螺旋矩阵搜索插入位置查找元素第一个位置和最后一个位置 螺旋矩阵 解法&#xff1a;模拟&#xff0c;核心在于你怎么转&#xff0c;还有就是处理边界&#xff0c;边界如何收缩&#xff0c;什么时候停止旋转。最内圈的时候怎么处理。 通过上图的模拟来解决这个问题&#xff1a;…

数据库锁等待排查方法、命令行安装数据库及授权文件更新

欢迎关注“数据库运维之道”公众号&#xff0c;一起学习数据库技术! 本期将为大家分享“数据库锁等待排查方法、命令行安装数据库及授权文件更新”的运维技能。 关键词&#xff1a;锁等待、V$LOCK、V$TRXWAIT、死锁、锁超时、命令行部署达梦、授权文件更新 当用户反馈执行SQL语…
最新文章