FATAL: DataSourcePool [db] is down or has network error!!!

503 views
Skip to first unread message

David Smith

unread,
Dec 23, 2020, 1:25:12 PM12/23/20
to Ebean ORM
Trying to connect to postgresql (Amazon RDS) using Play (sbt configs attached) and with this application.properties:
atasource:
   db:
    platform: postgres
    driver: org.postgresql.Driver
    username: "cpp"
    password: <REDACTED>

I get this error on the initial io.ebean.DB invocation:
[error] i.e.d.p.ConnectionPool - FATAL: DataSourcePool [db] is down or has network error!!!
[error] i.e.DbContext - Error trying to create the default Database
io.ebean.datasource.DataSourceInitialiseException: Error initialising DataSource with user: "cpp" url:"jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp" error:No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:250)
at io.ebean.datasource.pool.ConnectionPoolFactory.createPool(ConnectionPoolFactory.java:14)
at io.ebean.datasource.DataSourceFactory.create(DataSourceFactory.java:26)
at io.ebeaninternal.server.core.InitDataSource.create(InitDataSource.java:121)
at io.ebeaninternal.server.core.InitDataSource.createFromConfig(InitDataSource.java:116)
at io.ebeaninternal.server.core.InitDataSource.initDataSource(InitDataSource.java:49)
at io.ebeaninternal.server.core.InitDataSource.initialise(InitDataSource.java:34)
at io.ebeaninternal.server.core.InitDataSource.init(InitDataSource.java:25)
at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:234)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:90)
Caused by: java.sql.SQLException: No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:543)
at io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:538)
at io.ebean.datasource.pool.ConnectionPool.createConnectionForQueue(ConnectionPool.java:757)
at io.ebean.datasource.pool.PooledConnectionQueue.ensureMinimumConnections(PooledConnectionQueue.java:176)
at io.ebean.datasource.pool.ConnectionPool.initialise(ConnectionPool.java:298)
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:247)
at io.ebean.datasource.pool.ConnectionPoolFactory.createPool(ConnectionPoolFactory.java:14)
at io.ebean.datasource.DataSourceFactory.create(DataSourceFactory.java:26)

direct connects with psql work fine.



sbt-files.txt

Rob Bygrave

unread,
Dec 23, 2020, 10:00:45 PM12/23/20
to ebean@googlegroups
Caused by: java.sql.SQLException: No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at java.sql.DriverManager.getConnection(DriverManager.java:689)


This error suggests that the postgres jdbc driver is not in the classpath?  Can you check that?


Cheers, Rob.

--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/a13bb0a5-0ed3-4b1a-936a-bf97928967b1n%40googlegroups.com.

David Smith

unread,
Dec 24, 2020, 7:51:10 AM12/24/20
to Ebean ORM

Thank you for your quick response.  Yes, postgres is in the classpath:
[info] * Attributed(/opt/comcast/home/.cache/coursier/v1/https/repo1.maven.org/maven2/org/postgresql/postgresql/42.2.18/postgresql-42.2.18.jar)

Also, I check in the application for the presence of org.postgresql.Driver:

       try {
             DatabaseConfig dbconf = new DatabaseConfig();
             dbconf.loadFromProperties();
             dbconf.setName("db");
             System.out.println(dbconf.getProperties());
             System.out.println("loaded postgres driver: " + org.postgresql.Driver.getVersion());

         } catch (Exception e) {
            System.out.println(e);
            System.exit(1);
         }
   

This reports the following (including the fatal error):

(Server started, use Enter to stop and go back to the console...)

[info] p.a.d.DefaultDBApi - Database [default] initialized
[info] p.a.d.HikariCPConnectionPool - Creating Pool for datasource 'default'
{platform=postgres, datasource=, db=, url="jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp", password=<REDACTED>, driver=org.postgresql.Driver, username="cpp"}
loaded postgres driver: PostgreSQL JDBC Driver 42.2.18
[error] i.e.d.p.ConnectionPool - FATAL: DataSourcePool [db] is down or has network error!!!
[error] i.e.DbContext - Error trying to create the default Database
io.ebean.datasource.DataSourceInitialiseException: Error initialising DataSource with user: "cpp" url:"jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp" error:No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:250)
at io.ebean.datasource.pool.ConnectionPoolFactory.createPool(ConnectionPoolFactory.java:14)
at io.ebean.datasource.DataSourceFactory.create(DataSourceFactory.java:26)
at io.ebeaninternal.server.core.InitDataSource.create(InitDataSource.java:121)
at io.ebeaninternal.server.core.InitDataSource.createFromConfig(InitDataSource.java:116)
at io.ebeaninternal.server.core.InitDataSource.initDataSource(InitDataSource.java:49)
at io.ebeaninternal.server.core.InitDataSource.initialise(InitDataSource.java:34)
at io.ebeaninternal.server.core.InitDataSource.init(InitDataSource.java:25)
at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:234)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:90)
Caused by: java.sql.SQLException: No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:543)
at io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:538)
at io.ebean.datasource.pool.ConnectionPool.createConnectionForQueue(ConnectionPool.java:757)
at io.ebean.datasource.pool.PooledConnectionQueue.ensureMinimumConnections(PooledConnectionQueue.java:176)
at io.ebean.datasource.pool.ConnectionPool.initialise(ConnectionPool.java:298)
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:247)
at io.ebean.datasource.pool.ConnectionPoolFactory.createPool(ConnectionPoolFactory.java:14)
at io.ebean.datasource.DataSourceFactory.create(DataSourceFactory.java:26)
[error] p.a.h.DefaultHttpErrorHandler - 

! @7i7o9oa3j - Internal server error, for (GET) [/] ->
 
play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
  at core.OnStartup.<init>(OnStartup.java:23)
  at modules.StartupModule.configure(StartupModule.java:9) (via modules: com.google.inject.util.Modules$OverrideModule -> modules.StartupModule)
  while locating core.OnStartup

1 error]
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:211)
at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:142)
at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:302)
at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:224)
at akka.stream.impl.fusing.MapAsync$$anon$30.onPush(Ops.scala:1284)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:423)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625)
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:502)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:600)
Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
  at core.OnStartup.<init>(OnStartup.java:23)
  at modules.StartupModule.configure(StartupModule.java:9) (via modules: com.google.inject.util.Modules$OverrideModule -> modules.StartupModule)
  while locating core.OnStartup

1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:554)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:188)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:111)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:78)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:200)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:155)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.DevServerStart$$anon$1.$anonfun$reload$3(DevServerStart.scala:190)
at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
Caused by: java.lang.ExceptionInInitializerError: null
at io.ebean.DB.<clinit>(DB.java:65)
at core.OnStartup.seedData(OnStartup.java:40)
at core.OnStartup.<init>(OnStartup.java:36)
at core.OnStartup$$FastClassByGuice$$2a20abef.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
Caused by: java.lang.RuntimeException: io.ebean.datasource.DataSourceInitialiseException: Error initialising DataSource with user: "cpp" url:"jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp" error:No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at io.ebean.DbContext.<init>(DbContext.java:58)
at io.ebean.DbContext.<clinit>(DbContext.java:24)
at io.ebean.DB.<clinit>(DB.java:65)
at core.OnStartup.seedData(OnStartup.java:40)
at core.OnStartup.<init>(OnStartup.java:36)
at core.OnStartup$$FastClassByGuice$$2a20abef.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
Caused by: io.ebean.datasource.DataSourceInitialiseException: Error initialising DataSource with user: "cpp" url:"jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp" error:No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:250)
at io.ebean.datasource.pool.ConnectionPoolFactory.createPool(ConnectionPoolFactory.java:14)
at io.ebean.datasource.DataSourceFactory.create(DataSourceFactory.java:26)
at io.ebeaninternal.server.core.InitDataSource.create(InitDataSource.java:121)
at io.ebeaninternal.server.core.InitDataSource.createFromConfig(InitDataSource.java:116)
at io.ebeaninternal.server.core.InitDataSource.initDataSource(InitDataSource.java:49)
at io.ebeaninternal.server.core.InitDataSource.initialise(InitDataSource.java:34)
at io.ebeaninternal.server.core.InitDataSource.init(InitDataSource.java:25)
at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:234)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:90)
Caused by: java.sql.SQLException: No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:543)
at io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:538)
at io.ebean.datasource.pool.ConnectionPool.createConnectionForQueue(ConnectionPool.java:757)
at io.ebean.datasource.pool.PooledConnectionQueue.ensureMinimumConnections(PooledConnectionQueue.java:176)
at io.ebean.datasource.pool.ConnectionPool.initialise(ConnectionPool.java:298)
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:247)
at io.ebean.datasource.pool.ConnectionPoolFactory.createPool(ConnectionPoolFactory.java:14)
at io.ebean.datasource.DataSourceFactory.create(DataSourceFactory.java:26)


I've attached the full classpath from sbt in case there's a conflict in the jars

Thanks,
David Smith
sbt-classpath.txt

Rob Bygrave

unread,
Jan 18, 2021, 9:19:02 PM1/18/21
to ebean@googlegroups
Did you get any further on this issue?

> Caused by: java.sql.SQLException: No suitable driver found for "jdbc:postgresql://cpp-dev.cuhui0gwzwbs.us-east-1.rds.amazonaws.com/cpp"
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)

To me I'd suggest putting a break point in DriverManager and seeing if the Postgres JDBC driver is registered and if so why it isn't deemed valid for the url.
 

David Smith

unread,
Jan 19, 2021, 1:47:30 PM1/19/21
to Ebean ORM
No, I had to bypass the Play source code.  I'll see if I can dig into the Driver Manager

David Smith

unread,
Jan 19, 2021, 5:12:54 PM1/19/21
to Ebean ORM
This issue came up in migrating from Play 2.5 to Play 2.8 and with the corresponding migration from play ebean to io.ebean.  I'm pretty sure it's a configuration error on my part, but I haven't been able to find the documentation to show what needs to be set between application-local.conf and application.properties. 

I tried to just load a connection with DriverManager explicitly and that part worked, but when the driver loader in the ebeans pool tried it failed.  
My code was:
            DatabaseConfig dbconf = new DatabaseConfig();
31             dbconf.loadFromProperties();
32             dbconf.setName("db");
33             System.out.println(dbconf.getProperties());
34             String url = "jdbc:postgresql://<database server>/<user>";
35             Properties props = new Properties();
36             props.setProperty("user","<user>");
37             props.setProperty("password","<password>");
38             props.setProperty("ssl","false");
39             Connection conn = DriverManager.getConnection(url, props);
40        System.out.println("loaded postgres driver: " + conn.getMetaData().getDriverName() + " Version: "+conn.getMetaData().getDriverVersion());
41

When I ran this on SBT, the log shows that is successfully completes the DriverManager.getConnection and the System.out.println method executes showing that the connection worked:
info] p.a.d.DefaultDBApi - Database [default] initialized
[info] p.a.d.HikariCPConnectionPool - Creating Pool for datasource 'default'
{datasource=, url="jdbc:postgresql://<database server>/<user>", ebean=, platform=postgres, username="<user>", dbSchema=cpp, password="<password>", driver=org.postgresql.Driver, db=}
loaded postgres driver: PostgreSQL JDBC Driver Version: 42.2.18
[error] i.e.d.p.ConnectionPool - FATAL: DataSourcePool [db] is down or has network error!!!

So, can you point me to the proper configuration between io.ebean and Play that will read my database entries?

Thanks,
David Smith

David Smith

unread,
Jan 25, 2021, 4:05:52 PM1/25/21
to Ebean ORM
After some trial and error, I identified the configuration issue.  io.ebean uses the application.properties file, not the application.conf file required by the Play configuration and in the application.properties file the attribute values must NOT have quotes, while in the application.conf files they must HAVE quotes.

David Smith

Reply all
Reply to author
Forward
0 new messages