Network Adapter could not establish the connection - between JBoss and Oracle Database

Solution Unverified - Updated

Environment

  • JBoss Enterprise Applicatipn Platform (EAP)
    • 4
    • 5
    • 6
    • 7
  • Oracle Database

Issue

  • The following exception is seen when trying to connect to Oracle Database with JBoss Application Server.
Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

Resolution

This exception is thrown by the Oracle Driver because it could not connect to the Oracle Database.

  • If the Oracle Database is up and running, it is more than likely due to the fact that the hostname supplied by Oracle after the initial connection is not able to be resolved by the client machine.

  • EAP5 Check oracle-ds.xml connection url, check hostname supplied by oracle, and check client can resolve the hostname.

  • EAP6 and EAP7 Check the datasource configuration connection url, check hostname supplied by oracle, and check the client can resolve the hostname in the standalone*.xml or domain.xml.

  • Depending on the Oracle setup, the full tnsnames.ora connect string may be needed in the data source configuration including the SERVER=DEDICATED clause.

Root Cause

The hostname supplied by Oracle cannot be resolved by the client machine.

Without SERVER=DEDICATED under the CONNECT_DATA section, the connection will go to the Oracle dispatcher, which will give the client a hostname/port combination to use to access an actual database process and close the connection. The client then tries to connect to that, and this error occurs when that second connection fails.

With SERVER=DEDICATED, the dispatcher spawns a new worker process and hands the connection off to it directly, so the re-connection does not occur.

Diagnostic Steps

  • Check that the database is up and running and accessible from the client machine
  • Get the data source configuration info
  • Get the Oracle database configuration Information
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.