Glassfish 中的 Derby Pool ping 失败并显示 java.net.ConnectException

Derby Pool ping fails with java.net.ConnectException in Glassfish

我刚刚在 Ubuntu 14.04 上安装了 Glassfish 4.1 并尝试 ping DerbyPool 但失败 java.net.ConnectException。

Ping Connection Pool failed for DerbyPool. Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused. Please check the server.log for more details.

server.log:

[2015-01-02T20:51:12.361+0200] [glassfish 4.1] [WARNING] [test.connection.pool.failed] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=42 _ThreadName=admin-listener(4)] [timeMillis: 1420224672361] [levelValue: 900] [[ RAR8054: Exception while creating an unpooled [test] connection for pool [ DerbyPool ], Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused.]]

[2015-01-02T20:51:12.366+0200] [glassfish 4.1] [SEVERE] [] [org.glassfish.admingui] [tid: _ThreadID=40 _ThreadName=admin-listener(2)] [timeMillis: 1420224672366] [levelValue: 1000] [[ RestResponse.getResponse() gives FAILURE. endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=DerbyPool}']]

同样的问题出现在另一台安装了 Glassfish 4.1 和 Ubuntu 14.04 的计算机上。

我猜你没有启动 Derby 服务器。

要启动它,请转到命令行并导航到一个文件夹,您可以在其中 运行 asadmin(可能类似于 /glassfish/bin)和 运行 以下内容:

asadmin start-database

然后再次尝试 ping。