Cannot access Jaspersoft console or sync to JasperServer with ERROR - "Connection to localhost:5432 refused"
search cancel

Cannot access Jaspersoft console or sync to JasperServer with ERROR - "Connection to localhost:5432 refused"

book

Article ID: 9169

calendar_today

Updated On:

Products

CA Spectrum DX NetOps CA Performance Management - Usage and Administration

Issue/Introduction

Unable to access the Jaspersoft Console. When checking in the Jaspersoft Tomcat log, there is a very long exception listed, indicating connection issues:

Failed to obtain DB connection from data source 'springNonTxDataSource.quartzScheduler': org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. [See nested exception: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.]

Environment

CABI JasperReports 6.3.x or later

Cause

This error indicates a potential connection issue with postgresql database on port 5432 (default database installed) 

Resolution

There are several reasons this error may occur: 

  • PostgreSQL isn't running
  • PostgreSQL isn't listening for TCP/IP connections (listen_addresses in postgresql.conf)
  • PostgreSQL is listening on a different port to the one you're connecting on 

  1. First step is to verify PostgreSQL is running. A TOP should list the process. If not, you can also run a netstat on default PostgreSQL port 5432 to see if the port is connecting. If PostgreSQL is not running, you can start it using the available startservers.sh script:

    <CABI INSTALL DIR>/startServers.sh

  2. You can also verify default port 5432 is open by running:


    for Windows:
    netstat -ano | grep -i 5432

    for Linux:  
    netstat -apn | grep -i 5432  

  3. Check local IP tables are turned off/disabled

  4. Check external firewall rules for potential blocking port 5432

  5. The address and port configuration are located in:

    <CABI INSTALL DIR>/postgresql/data/postgresql.conf


    Verify the port setting is correct.

  6. Run a sniffer trace (such as using WireShark on the JasperServer machine) to check connection to PostgreSQL database

Additional Information

If the above does not solve the issue, there are other possibilities which can be reviewed by the links below: 

https://www.postgresql.org/message-id/[email protected]

https://stackoverflow.com/questions/20825734/postgresql-connection-refused-check-that-the-hostname-and-port-are-correct-an 

http://www.postgresql-archive.org/Connection-refused-Check-that-the-hostname-and-port-are-correct-td2081524.html