0

I am using postgres + hibernate + jboss final 6.0.0 server.

When I try to open the database connection, it throws the following exception:

Caused by: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already
2011-10-11 04:28:06,921 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:291)
2011-10-11 04:28:06,921 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:108)
2011-10-11 04:28:06,922 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
2011-10-11 04:28:06,922 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
2011-10-11 04:28:06,922 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
2011-10-11 04:28:06,922 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)
2011-10-11 04:28:06,922 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:30)
2011-10-11 04:28:06,922 ERROR [STDERR] (http-69.89.2.245-8080-11)
  at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
1
  • 4
    Does first message (too many clients connected) offer any hints? Commented Oct 11, 2011 at 8:39

3 Answers 3

3

Check max_connections property in postgresql.conf. By default it's 100. Increase it if you need. Also check that you close your connections.

Sign up to request clarification or add additional context in comments.

Comments

0

You have hit the maximum limit of allowed clients set in postgresql.conf.

You should check this configuration file, and increase the max_connections variable or check the min-pool-size and max-pool-size values at your JBoss datasource declaration, and set lower values to meet the Postgres configuration.

Comments

0

To clear your database connections:

Start a psql terminal and:

SELECT pg_terminate_backend(pg_stat_activity.procpid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'YOUR_DATABASE_NAME';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.