Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala Repo Server: make app crash instead of hanging when run with no arguments #106

Closed
alexanderdean opened this issue Dec 12, 2015 · 2 comments

Comments

@alexanderdean
Copy link
Member

Doesn't crash but just hangs indefinitely:

$ java -jar iglu-server-0.2.0-rc1
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.snowplowanalytics.iglu.server.Boot.main(Boot.scala)
Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:207)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
    at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
    at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
    at org.postgresql.Driver.makeConnection(Driver.java:410)
    at org.postgresql.Driver.connect(Driver.java:280)
    at java.sql.DriverManager.getConnection(DriverManager.java:571)
    at java.sql.DriverManager.getConnection(DriverManager.java:187)
    at scala.slick.jdbc.JdbcBackend$DatabaseFactoryDef$$anon$4.createConnection(JdbcBackend.scala:70)
    at scala.slick.jdbc.JdbcBackend$BaseSession.conn$lzycompute(JdbcBackend.scala:397)
    at scala.slick.jdbc.JdbcBackend$BaseSession.conn(JdbcBackend.scala:397)
    at scala.slick.jdbc.JdbcBackend$BaseSession.metaData$lzycompute(JdbcBackend.scala:398)
    at scala.slick.jdbc.JdbcBackend$BaseSession.metaData(JdbcBackend.scala:398)
    at scala.slick.jdbc.meta.MTable$$anonfun$getTables$1.apply(MTable.scala:26)
    at scala.slick.jdbc.meta.MTable$$anonfun$getTables$1.apply(MTable.scala:26)
    at scala.slick.jdbc.ResultSetInvoker$$anon$3.createResultSet(ResultSetInvoker.scala:34)
    at scala.slick.jdbc.ResultSetInvoker.iteratorTo(ResultSetInvoker.scala:17)
    at scala.slick.jdbc.Invoker$class.foreach(Invoker.scala:64)
    at scala.slick.jdbc.ResultSetInvoker.foreach(ResultSetInvoker.scala:12)
    at scala.slick.jdbc.Invoker$class.build(Invoker.scala:47)
    at scala.slick.jdbc.ResultSetInvoker.build(ResultSetInvoker.scala:12)
    at scala.slick.jdbc.Invoker$class.list(Invoker.scala:39)
    at scala.slick.jdbc.ResultSetInvoker.list(ResultSetInvoker.scala:12)
    at com.snowplowanalytics.iglu.server.TableInitialization$$anonfun$initializeTables$1.apply$mcV$sp(Core.scala:70)
    at com.snowplowanalytics.iglu.server.TableInitialization$$anonfun$initializeTables$1.apply(Core.scala:69)
    at com.snowplowanalytics.iglu.server.TableInitialization$$anonfun$initializeTables$1.apply(Core.scala:69)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
    at scala.slick.backend.DatabaseComponent$class.withDynamicSession(DatabaseComponent.scala:67)
    at scala.slick.jdbc.JdbcBackend$.withDynamicSession(JdbcBackend.scala:448)
    at scala.slick.backend.DatabaseComponent$DatabaseDef$$anonfun$withDynSession$1.apply(DatabaseComponent.scala:51)
    at scala.slick.backend.DatabaseComponent$DatabaseDef$$anonfun$withDynSession$1.apply(DatabaseComponent.scala:51)
    at scala.slick.backend.DatabaseComponent$DatabaseDef$class.withSession(DatabaseComponent.scala:34)
    at scala.slick.jdbc.JdbcBackend$DatabaseFactoryDef$$anon$4.withSession(JdbcBackend.scala:61)
    at scala.slick.backend.DatabaseComponent$DatabaseDef$class.withDynSession(DatabaseComponent.scala:51)
    at scala.slick.jdbc.JdbcBackend$DatabaseFactoryDef$$anon$4.withDynSession(JdbcBackend.scala:61)
    at com.snowplowanalytics.iglu.server.TableInitialization$.initializeTables(Core.scala:69)
    at com.snowplowanalytics.iglu.server.BootedCore$class.$init$(Core.scala:55)
    at com.snowplowanalytics.iglu.server.Boot$.<init>(Boot.scala:18)
    at com.snowplowanalytics.iglu.server.Boot$.<clinit>(Boot.scala)
    ... 1 more
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at org.postgresql.core.PGStream.<init>(PGStream.java:60)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:101)
    ... 42 more
@fblundun
Copy link
Contributor

This happens because if you don't supply your own configuration file (and don't have the environment variables set by Elastic Beanstalk), this default gets used. So unless you have Postgres accessible on localhost:5432, the server will error.

@alexanderdean
Copy link
Member Author

Hey @fblundun - is there a way of crashing rather than hanging? I ask because I think the hanging is making it very hard for Beanstalk to detect that the app is failing to start...

@alexanderdean alexanderdean changed the title Scala Repo Server: running with no arguments causes app to hang Scala Repo Server: made app crash instead of hanging when run with no arguments Feb 6, 2016
@alexanderdean alexanderdean changed the title Scala Repo Server: made app crash instead of hanging when run with no arguments Scala Repo Server: make app crash instead of hanging when run with no arguments Feb 6, 2016
fblundun added a commit that referenced this issue Feb 12, 2016
fblundun added a commit that referenced this issue Feb 12, 2016
fblundun added a commit that referenced this issue Feb 12, 2016
fblundun added a commit that referenced this issue Feb 12, 2016
fblundun added a commit that referenced this issue Feb 12, 2016
fblundun added a commit that referenced this issue Feb 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants