Home > Back-end >  Mysql tomcat SPRNGMVC druid connection problem, a great god help have a look
Mysql tomcat SPRNGMVC druid connection problem, a great god help have a look

Time:10-04

The database connection: driverClassName=com. Mysql. Cj). The JDBC Driver
Mysql version: 5.7
The JDK: 1.8

Problem description: a while will be submitted to the following anomaly, but system can use; Tomcat has stopped publishing system and then we may not be able to start; Can be normal start tomcat again after restart the server and the database connection

The 2018-05-02 22:13:47. 19 | create connection SQLException,
Url: JDBC: mysql://172.30.18.236:3306/bd_mes? ServerTimezone=Hongkong& useUnicode=true& CharacterEncoding=utf8 & amp; UseSSL=false& AutoReconnect=true& UseServerPrepStmts=true, errorCode 0, 08001
the state
Java. SQL. SQLNonTransientConnectionException: Could not create connection to the database server Attempted reconnect 3 times. Giving up.
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 108)
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 95)
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 87)
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 61)
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 71)
At com. Mysql. Cj. JDBC. ConnectionImpl. ConnectWithRetries (ConnectionImpl. Java: 932)
At com. Mysql. Cj. JDBC. ConnectionImpl. CreateNewIO (ConnectionImpl. Java: 857)
At com. Mysql. Cj. JDBC. ConnectionImpl. & lt; init> (ConnectionImpl. Java: 444)
At com. Mysql. Cj. JDBC. ConnectionImpl. GetInstance (ConnectionImpl. Java: 230)
At com. Mysql. Cj. JDBC. NonRegisteringDriver. Connect (NonRegisteringDriver. Java: 226)
At com. Alibaba. Druid. Filter. FilterChainImpl. Connection_connect (FilterChainImpl. Java: 149)
At com. Alibaba. Druid. Filter. Stat. StatFilter. Connection_connect (StatFilter. Java: 218)
At com. Alibaba. Druid. Filter. FilterChainImpl. Connection_connect (FilterChainImpl. Java: 143)
At com. Alibaba. Druid. Pool. DruidAbstractDataSource. CreatePhysicalConnection (DruidAbstractDataSource. Java: 1515)
At com. Alibaba. Druid. Pool. DruidAbstractDataSource. CreatePhysicalConnection (DruidAbstractDataSource. Java: 1578)
At com. Alibaba. Druid. Pool. DruidDataSource $CreateConnectionThread. Run (2466) DruidDataSource. Java:
Under Caused by: com. Mysql. Cj. Exceptions. CJCommunicationsException: Communications link failure

The last packet sent successfully to The server was 0 milliseconds line. The driver has not received any packets from The server.
At sun. Reflect. NativeConstructorAccessorImpl. NewInstance0 (Native Method)
At sun. Reflect. NativeConstructorAccessorImpl. NewInstance (Unknown Source)
At sun. Reflect. DelegatingConstructorAccessorImpl. NewInstance (Unknown Source)
The at Java. Lang. Reflect. Constructor. NewInstance (Unknown Source)
At com. Mysql. Cj. Exceptions. ExceptionFactory. CreateException (ExceptionFactory. Java: 59)
At com. Mysql. Cj. Exceptions. ExceptionFactory. CreateException (ExceptionFactory. Java: 103)
At com. Mysql. Cj. Exceptions. ExceptionFactory. CreateException (ExceptionFactory. Java: 149)
At com. Mysql. Cj. Exceptions. ExceptionFactory. CreateCommunicationsException (ExceptionFactory. Java: 165)
At com. Mysql. Cj. Protocol. A.N ativeSocketConnection. Connect (NativeSocketConnection. Java: 92)
At com. Mysql. Cj. NativeSession. Connect (NativeSession. Java: 152)
At com. Mysql. Cj. JDBC. ConnectionImpl. ConnectWithRetries (ConnectionImpl. Java: 876)
. 10 more
Under Caused by: java.net.SocketException: No buffer space available (maximum connections reached?) : connect
The at java.net.DualStackPlainSocketImpl.connect0 (Native Method)
The at java.net.DualStackPlainSocketImpl.socketConnect (Unknown Source)
The at java.net.AbstractPlainSocketImpl.doConnect (Unknown Source)
The at java.net.AbstractPlainSocketImpl.connectToAddress (Unknown Source)
The at java.net.AbstractPlainSocketImpl.connect (Unknown Source)
The at java.net.PlainSocketImpl.connect (Unknown Source)
The at java.net.SocksSocketImpl.connect (Unknown Source)
The at java.net.Socket.connect (Unknown Source)
At com. Mysql. Cj. Protocol. StandardSocketFactory. Connect (StandardSocketFactory. Java: 173)
At com. Mysql. Cj. Protocol. A.N ativeSocketConnection. Connect (NativeSocketConnection. Java: 66)
. 12 more

CodePudding user response:

Should be a connection pool is not closed, transaction management configuration, the consequences of not closing connection after the execution of the SQL exceeds the maximum value

CodePudding user response:

Upstairs positive solutions, support

CodePudding user response:

reference 1st floor u013835778 response:
should be a connection pool is not closed, transaction management configuration, after executing the SQL not closing the consequences of a maximum number of connections than

But normal speaking, application service restart connection must also released

CodePudding user response:

How are you, you of the problem in the end is how to solve? It can't be to restart the server
  • Related