【问题标题】:Setting up a database in glassfish server 4.1在 glassfish 服务器 4.1 中设置数据库
【发布时间】:2015-04-13 13:31:18
【问题描述】:

正如 oracle documentation 中指定的那样,我正在尝试在 glassfish 服务器中设置数据库。我的 JDK 版本是 1.8,glassfish 是 4.1。我正在使用 ojdbc7.jar。

我已将 ojdbc 放入 \glassfish\domains\domain1\lib\ext 文件夹并重新启动服务器和数据库。但是当我尝试 ping 时,出现错误:

Ping Connection Pool failed for TestPool. Connection could not be allocated because: IO Error: The Network Adapter could not establish the connection

在 server.log 中我发现:

2015-04-13T18:35:25.413+0530] [glassfish 4.1] [WARNING] [test.connection.pool.failed] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=45 _ThreadName=admin-listener(2)] [timeMillis: 1428930325413] [levelValue: 900] [[
  RAR8054: Exception while creating an unpooled [test] connection for pool [ TestPool ], Connection could not be allocated because: IO Error: The Network Adapter could not establish the connection]]

但我可以成功 ping 默认在 glassfish 中的“Derby Pool”。我已经设置了文档中提到的所有连接池属性和 JVM 选项。

有人可以帮忙正确设置吗?

提前致谢。

【问题讨论】:

    标签: java-8 oracle12c glassfish-4.1


    【解决方案1】:

    驱动程序似乎无法连接到 oracle 实例。

    确保您可以建立从 glassfish 到 oracle 服务器的连接。特别是检查主机名/端口(默认oracle端口号是1521)。

    【讨论】:

    • 我也用过 ojdbc6.jar。但结果相同。
    【解决方案2】:

    这是我的设置快照:

    但在尝试 ping 时,我在服务器日志中发现了这些:

    RAR8054: Exception while creating an unpooled [test] connection for pool [ TEST ], Connection could not be allocated because: IO Error: The Network Adapter could not establish the connection]]
    

    这是由于服务器错误,因为我使用的是 glassfish 4.1。

    【讨论】:

    • oracle数据库是否安装在同一台主机上?服务是否正在运行?
    • 首先,这些属性不是必需的。使用其中三个,您就可以完成工作(用户、密码、URL)。同样,在连接 glassfish 之前,请测试您与 sqlplus 或 sqldeveloper 的连接,例如;如果您可以连接任何这些工具,那么您应该没有问题。希望对您有所帮助
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-15
    • 1970-01-01
    • 2017-01-10
    • 2011-05-19
    • 2019-07-08
    相关资源
    最近更新 更多