please give me a chance to explain my mysterious situation.
My Glassfish server cannot connect to the remote MySQL database.
I checked following instructions
- ping to remote host - OK
- connect via mysql command (mysql -h remote -u user -p) - OK
- ssh port forwarding (ssh -L13306:localhost:3306 remote) and configure the glassfish to use it (jdbc://127.0.0.0:13306/mydb) - OK
I think my configurations (server name, database name, user name and password) are correct. But still cannot connect to the database.
My environment:
local side
- Ubuntu 17.04
- Oracle Java 1.8.0 u131
- Glassfish 4.1 (build 13)
- MySQL Connector/J 5.1.41
remote side
- FreeBSD 11
- MySQL 5.5.46
I have googled last night, but cannot found the answer.
28 Apr. Edited:
My server.log says:
[2017-04-26T09:03:07.932+0900] [glassfish 4.1] [WARNING] [test.connection.pool.failed] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=98 _ThreadName=admin-listen
er(6)] [timeMillis: 1493164987932] [levelValue: 900] [[
RAR8054: Exception while creating an unpooled [test] connection for pool [ MysqlMacms ], Connection could not be allocated because: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.]]
[2017-04-26T09:03:07.940+0900] [glassfish 4.1] [SEVERE] [] [org.glassfish.admingui] [tid: _ThreadID=49 _ThreadName=admin-listener(5)] [timeMillis: 1493164987940] [levelValue: 1000] [[
RestResponse.getResponse() gives FAILURE. endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=admtkMysqlMacms}']]