2017-10-11 164 views
1

我正在尝试在glassfish 5中为Microsoft SQL Server数据库创建jdbc连接池。我使用的是mssql-jdbc-6.2.2.jre8.jar和最新的SQLExpress服务器版本(MSSQL14.SQLEXPRESS)Glassfish中的JDBC连接池ping错误

资源类型:javax.sql.DataSource

数据源类名称:com.microsoft.sqlserver.jdbc.SQLServerDataSource

enter image description here enter image description here 连接池创建成功,但是当我尝试ping,我得到这个错误:

Ping Connection Pool failed for sql_tire_pool. Connection could not be allocated because: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Unsupported curveId: 29". ClientConnectionId:f86f1ef8-29c4-4e39-b112-f5da9cbfe13d Please check the server.log for more details.

而这个我•服务器日志:

[2017-10-11T10:55:11.747+0300] [glassfish 5.0] [WARNING] [test.connection.pool.failed] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=125 _ThreadName=admin-listener(7)] [timeMillis: 1507708511747] [levelValue: 900] [[ RAR8054: Exception while creating an unpooled [test] connection for pool [ test_pool ], Connection could not be allocated because: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Unsupported curveId: 29". ClientConnectionId:4c325981-4c97-4db2-b4fb-f7aafca4f03b]]

[2017-10-11T10:55:11.750+0300] [glassfish 5.0] [SEVERE] [] [org.glassfish.admingui] [tid: _ThreadID=51 _ThreadName=admin-listener(3)] [timeMillis: 1507708511750] [levelValue: 1000] [[ RestResponse.getResponse() gives FAILURE. endpoint = ' http://localhost:4848/management/domain/resources/ping-connection-pool.json '; attrs = '{id=test_pool}']]

我运行Windows 10,也都在本地运行(GlassFish安装,SQL服务器)

UPDATE

使用公认的答案的解决方案,问题是部分解决了。连接池现在成功地ping了数据库,但是我遇到了同样的问题,因为当我的应用程序尝试通过jpa/hibernate运行查询时,在glassfish日志中抛出了同样的错误。

+0

它看起来像[SSL对于Microsoft SQL Server是必需的](https://blogs.msdn.microsoft.com/jdbcteam/2008/09/09/the -driver-可以-未建立-A-安全连接到SQL服务器逐使用安全的套接字层的SSL加密/)。愚蠢的问题:你有没有试过[启用SSL](https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-with-ssl-encryption)配置? – Al1

+0

其实我并没有因为此刻我不需要SSL ... 虽然我用连接到glassfish-4安装的同样的数据库没有问题。 – jenny

+0

完全相同的问题在这里(因为这个,无法升级到GlassFish 5.0,尽管它在4.1.1上工作正常),你是否能够修复这个问题? –

回答

3

Glassfish的5上也面临这样的问题,与的Windows 10,禁用椭圆曲线的伎俩,只需添加:

-Dcom.sun.net.ssl.enableECC=false 

到Glassfish的JVM选项,然后重新启动服务器。 在glassfish问题跟踪器上发布了解决方法,以帮助他们快速修复它

+0

不幸的是,这在我的情况下不起作用。错误持续存在。 –