Я использовал 'allowPublicKeyRetrieval = false & useSSL = false' в моем jdbcURL ( Соединение Java-MySql: получение открытого ключа не разрешено ), но у меня не работает.
TestDb.java
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String user="springstudent";
String pass="springstudent";
String jdbcUrl = "jdbc:mysql://localhost:3306/web_customer_tracker&allowPublicKeyRetrieval=false&useSSL=false&serverTimeZone=UTC";
String driver="com.mysql.cj.jdbc.Driver";
try {
PrintWriter out = response.getWriter();
out.println("Connecting to database "+jdbcUrl);
Class.forName(driver);
Connection myConn = DriverManager.getConnection(jdbcUrl,user,pass);
out.println("Success!");
myConn.close();
}catch(Exception e) {
e.printStackTrace();
}
}
Вот то, что показывает моя консоль
Mar 04, 2019 9:14:22 AM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@2b9bacb8 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
Mar 04, 2019 9:14:22 AM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@2e4d3979 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:832)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Mar 04, 2019 9:14:22 AM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@2b9bacb8 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
Mar 04, 2019 9:14:22 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
Mar 04, 2019 9:14:22 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl makeLobCreatorBuilder
INFO: HHH000422: Disabling contextual LOB creation as connection was null
Mar 04, 2019 9:14:23 AM org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateService
INFO: HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
Mar 04, 2019 9:14:23 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: Completed initialization in 35480 ms
Я также попытался перезапустить сервер MySQL, но пошел в вене.Как я могу решить это?Заранее спасибо