- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在一段时间不活动后调用数据库代码时出现异常
java.sql.SQLNonTransientConnectionException: Could not read resultset: Connection reset
at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136)
at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:264)
at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:288)
at org.mariadb.jdbc.MySQLStatement.executeQuery(MySQLStatement.java:302)
at org.mariadb.jdbc.MySQLStatement.executeQuery(MySQLStatement.java:361)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at com.vimba.database.DBFactory.attemptLoginWithTempPasswordDetails(DBFactory.java:181)
at com.vimba.database.DBFactory.authenticate(DBFactory.java:131)
at com.vimba.service.ExposedFunctions.login(ExposedFunctions.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:210)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:132)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:241)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:74)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:226)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:375)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:175)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:159)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.mariadb.jdbc.internal.common.QueryException: Could not read resultset: Connection reset
at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:926)
at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:991)
at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:281)
... 40 more
Caused by: java.net.SocketException: Connection reset
我尝试更改/etc/my.cnf 以添加一周的 wait_timeout,但没有任何区别;
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld/mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# Currently, there are mariadb and community-mysql packages in Fedora.
# This particular config file is included in respective RPMs of both of them,
# so the following settings are general and will be also used by both of them.
# Otherwise the RPMs would be in conflict.
# Settings for particular implementations like MariaDB are then
# defined in appropriate sections; for MariaDB server in [mariadb] section in
# /etc/my.cnf.d/server.cnf (part of mariadb-server).
# It doesn't matter that we set these settings only for [mysqld] here,
# because they will be read and used in mysqld_safe as well.
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysqld_safe]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
#one week timeout to see if exception goes
wait_timeout=604800
event_scheduler=on
/etc/my.cnf (END)
有谁知道如何解决这个问题?
最佳答案
您可以配置DBCP为您进行连接检查。在你的配置中添加这样的东西
validationQuery="/* ping */ SELECT 1"
testOnBorrow="true"
每次从池中获取连接时,DBCP 都会检查连接是否存在,丢弃死连接并在需要时创建新连接
关于java - 如何解决java.sql.SQLNonTransientConnectionException : Could not read resultset: Connection reset?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25054095/
编辑 我创建了包含加载内容的方法的任务。我需要任务,因为我想在数据加载期间将进度条设置为未确定状态。加载数据时,进度条设置为“1”(已完成)。 我想要实现的是:用户登录,但没有连接,因此进度条指示应用
在我的java项目中,我从utf8切换到utf8mb4。我删除了数据库,然后使用 utf8mb4 创建了一个新数据库。我还使用 https://mathiasbynens.be/notes/mysql
我正在使用Spring框架的JdbcTemplate机制。我还有调度程序类来解析大型 XML 文件(> 500mb),这些文件是在基于 xml 的配置中使用 cron 表达式进行调度的,其中 pool
假设如下: private static NamedParameterJdbcTemplate jdbcTemplate; public static SqlRowSet foo(String
我试图通过 Wamp 将我的 java 程序连接到 MySql 数据库,但我得到的只是大量的 SQL 异常。 我已经尝试了 Stackoverflow 上几乎所有可用的问题或查询或答案,但没有一个答案
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server
我使用database.properties来保存我的数据库信息。但是,每次我运行代码时,它都会弹出此错误。我不知道数据库的哪一部分有问题。请帮忙! host: 127.0.0.1 port: 330
我多年来一直在 Google 平台上使用 MySQL(“Cloud SQL”)。第一代。仅限 SSL 连接。我的所有证书已经准备好几个月了并且运行得很好。我的证书没有过期。在过去的一天半里我一直无法连
我正在尝试编写代码,使用 Eclipse、MySQL Workbench 和 JDBC 8.0.11 将文本文件的数据导入数据库。它给了我一个 ClassNotFoundException。我已经查看
当我使用 MySQL (5.7.X) 启动 Spring boot(1.3) 应用程序时,在应用程序启动时出现以下异常。任何帮助将不胜感激 驱动程序管理连接状态不当并失败 java.sql.SQLNo
我正在使用 Derby 数据库并尝试在我的 JSP 应用程序中连接到它。我正在尝试通过使用正确的 URL 和数据库凭据调用 DriverManager.getConnection() 来连接数据库。但
我正在使用 Derbyclient(本地托管的数据库)开发一个 java 项目。我已经完成了所有事情,除了当我尝试桌面应用程序而没有手动连接到数据库(来自 Netbeans)时,标题中的错误弹出,我似
我在我的应用程序中实现了 derby 数据库以保存我的数据,并且在 Derby 数据库中检索结果集形式 select 查询时遇到此异常。为了建立连接,我使用连接字符串作为: 我使用这种方法建立连接:
在一段时间不活动后调用数据库代码时出现异常 java.sql.SQLNonTransientConnectionException: Could not read resultset: Connect
如果将 MySQL JDBC 驱动程序从 5.1.38 更改为 6.0.2 我会得到以下异常 java.sql.SQLNonTransientConnectionException: CLIENT_P
我在桌面应用程序中工作,我需要连接到数据库以检索一些数据并生成报告。出于测试目的,我在 Derby 中创建了一个测试数据库,其中包含我需要的表和其中的一些虚拟数据。 由于它是一个小型应用程序,我决定使
我正在尝试连接到 cassandra 数据库并验证用户以登录并注册我收到此错误: Keyspace names must be composed of alphanumerics and unders
我在使用 jdbc 连接到 Cassandra 数据库时遇到问题。 我收到一条错误消息SQLNonTransientConnectionException:键空间名称必须由字母数字和下划线组成 这是我
在运行 docker up 时,我收到“java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
我正在尝试安装并运行 Java EE 6 教程示例。在这个特殊案例中,杜克大学的森林案例研究示例。第一个安装步骤“创建 JDBC 领域并填充数据库”没有问题,显然 JavaDB 已创建并填充。但在第二
我是一名优秀的程序员,十分优秀!