LD4P / sinopia_server

[Deprecated - switching to MongoDB] Sinopia Back-end CRUD Service. LDP-inspired, HTTP Server taking JSON-LD resources & administrative metadata.
Apache License 2.0
1 stars 1 forks source link

DB Connection error when running in AWS #96

Closed rsmith11 closed 5 years ago

rsmith11 commented 5 years ago

After switching the trellis container definition to the ld4p/trellis-ext-db version, I got lots of DB connection errors upon startup, causing the container to stop running. The logs are:

ERROR [2019-04-18 23:15:37,876] org.apache.tomcat.jdbc.pool.ConnectionPool: Unable to create initial connections of pool. ! java.net.UnknownHostException: database ! at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) ! at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ! at java.net.Socket.connect(Socket.java:589) ! at org.postgresql.core.PGStream.<init>(PGStream.java:70) ! at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:91) ! at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192) ! ... 20 common frames omitted ! Causing: org.postgresql.util.PSQLException: The connection attempt failed. ! at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292) ! at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ! at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195) ! at org.postgresql.Driver.makeConnection(Driver.java:454) ! at org.postgresql.Driver.connect(Driver.java:256) ! at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ! at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ! at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:739) ! at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:671) ! at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) ! at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) ! at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ! at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ! at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ! at io.dropwizard.migrations.AbstractLiquibaseCommand.createDatabase(AbstractLiquibaseCommand.java:94) ! at io.dropwizard.migrations.AbstractLiquibaseCommand.openLiquibase(AbstractLiquibaseCommand.java:79) ! at io.dropwizard.migrations.AbstractLiquibaseCommand.run(AbstractLiquibaseCommand.java:67) ! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87) ! at io.dropwizard.cli.Cli.run(Cli.java:78) ! at io.dropwizard.Application.run(Application.java:93) ! at org.trellisldp.ext.db.app.TrellisApplication.main(TrellisApplication.java:38) org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195) at org.postgresql.Driver.makeConnection(Driver.java:454) at org.postgresql.Driver.connect(Driver.java:256) at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:739) at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:671) at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) at io.dropwizard.migrations.AbstractLiquibaseCommand.createDatabase(AbstractLiquibaseCommand.java:94) at io.dropwizard.migrations.AbstractLiquibaseCommand.openLiquibase(AbstractLiquibaseCommand.java:79) at io.dropwizard.migrations.AbstractLiquibaseCommand.run(AbstractLiquibaseCommand.java:67) at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87) at io.dropwizard.cli.Cli.run(Cli.java:78) at io.dropwizard.Application.run(Application.java:93) at org.trellisldp.ext.db.app.TrellisApplication.main(TrellisApplication.java:38) Caused by: java.net.UnknownHostException: database at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.postgresql.core.PGStream.<init>(PGStream.java:70) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:91) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192) ... 20 more INFO [2019-04-18 23:15:41,456] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: / INFO [2019-04-18 23:15:41,462] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: / INFO [2019-04-18 23:15:42,883] org.trellisldp.file.FileMementoService: Storing Mementos as files at /opt/trellis/data/mementos INFO [2019-04-18 23:15:42,992] org.trellisldp.ext.db.DBResourceService: Using database persistence with TrellisLDP INFO [2019-04-18 23:15:43,000] org.trellisldp.file.FileBinaryService: Storing binaries as files at /opt/trellis/data/binaries INFO [2019-04-18 23:15:43,103] org.trellisldp.ext.db.app.AppUtils: Connecting to JMS broker at tcp://broker:61616 org.trellisldp.api.RuntimeTrellisException: javax.jms.JMSException: Could not connect to broker URL: tcp://broker:61616. Reason: java.net.UnknownHostException: broker at org.trellisldp.ext.db.app.AppUtils.getNotificationService(AppUtils.java:96) at org.trellisldp.ext.db.app.TrellisServiceBundler.<init>(TrellisServiceBundler.java:77) at org.trellisldp.ext.db.app.TrellisApplication.initialize(TrellisApplication.java:64) at org.trellisldp.ext.db.app.TrellisApplication.initialize(TrellisApplication.java:27) at org.trellisldp.app.AbstractTrellisApplication.run(AbstractTrellisApplication.java:119) at org.trellisldp.app.AbstractTrellisApplication.run(AbstractTrellisApplication.java:53) at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43) at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87) at io.dropwizard.cli.Cli.run(Cli.java:78) at io.dropwizard.Application.run(Application.java:93) at org.trellisldp.ext.db.app.TrellisApplication.main(TrellisApplication.java:38) Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://broker:61616. Reason: java.net.UnknownHostException: broker at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:374) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:304) at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:244) at org.trellisldp.ext.db.app.AppUtils.buildJmsPublisher(AppUtils.java:80) at org.trellisldp.ext.db.app.AppUtils.getNotificationService(AppUtils.java:94) ... 10 more Caused by: java.net.UnknownHostException: broker at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:525) at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:488) at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55) at org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:169) at org.apache.activemq.transport.InactivityMonitor.start(InactivityMonitor.java:52) at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64) at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72) at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64) at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:354) ... 14 more

The ENV variables I'm passing to it are at https://github.com/sul-dlss/terraform-aws/blob/ce6d77a215b315364bab7650609c7846b0d2d3e8/organizations/development/sinopia/container_definitions/sinopia_trellis.json#L29