playframework 2.4 basic ebean configuration - playframework-2.4

I am trying to convert a play project from 2.3 to 2.4, and managed to get it to compile following the migration guide.
However I'm not sure how to get a basic working mysql database connection.
At run time it gives me pages of stack traces like the output pasted below.
build.sbt
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
...
"org.the" % "model-dal" % "1.2.3-SNAPSHOT",
The application.conf
play.evolutions.enabled=false
ebean.thedb=["models.theapp.*"]
Created a ebean.properties file:
datasource.thedb.username=user
datasource.thedb.password=password
datasource.thedb.databaseUrl=jdbc:mysql://127.0.0.1:3306/thedb
datasource.thedb.databaseDriver=com.mysql.jdbc.Driver
plugins.sbt entries
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "2.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
Stack trace
! #6o56g5bnj - Internal server error, for (GET) [/] ->
play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:
1) Error in custom provider, Configuration error: Configuration error[null]
while locating play.db.ebean.DefaultEbeanConfig$EbeanConfigParser
at play.db.ebean.EbeanModule.bindings(EbeanModule.java:24):
Binding(interface play.db.ebean.EbeanConfig to ProviderConstructionTarget(class play.db.ebean.DefaultEbeanConfig$EbeanConfigParser) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
while locating play.db.ebean.EbeanConfig
for parameter 0 at play.db.ebean.EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:36)
at play.db.ebean.EbeanDynamicEvolutions.class(EbeanDynamicEvolutions.java:33)
while locating play.db.ebean.EbeanDynamicEvolutions
at play.db.ebean.EbeanModule.bindings(EbeanModule.java:23):
Binding(class play.api.db.evolutions.DynamicEvolutions to ConstructionTarget(class play.db.ebean.EbeanDynamicEvolutions) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
while locating play.api.db.evolutions.DynamicEvolutions
while locating play.api.db.evolutions.ApplicationEvolutionsProvider
at play.api.db.evolutions.EvolutionsModule.bindings(EvolutionsModule.scala:22):
Binding(class play.api.db.evolutions.ApplicationEvolutions to ProviderConstructionTarget(class play.api.db.evolutions.ApplicationEvolutionsProvider) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
while locating play.api.db.evolutions.ApplicationEvolutions
Caused by: Configuration error: Configuration error[null]
at play.api.Configuration$.configError(Configuration.scala:178)
at play.api.Configuration.reportError(Configuration.scala:829)
at play.Configuration.reportError(Configuration.java:351)
at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.parse(DefaultEbeanConfig.java:81)
at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:60)
at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:44)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)

(1)
Disabling evolutions is required in the application.conf or the exception above appears.
play.evolutions.enabled=false
(2)
The database configuration is needed in the play db. properties in the application.conf file, the ebean.properties file is not required.
application.conf
db.thedb.username=user
db.thedb.password=password
db.thedb.databaseUrl=jdbc:mysql://127.0.0.1/thedb
db.thedb.databaseDriver=com.mysql.jdbc.Driver

Related

Extension [/opt/apache-druid-0.20.1/dist/druid/extensions/druid-orc-extensions] specified in "druid.extensions.loadList" didn't exist?

I am trying to deploy apache/druid:0.20.1 in Kube. I am getting error:
Extension [/opt/apache-druid-0.20.1/dist/druid/extensions/druid-orc-extensions] specified in "druid.extensions.loadList" didn't exist!?
I have taken off druid-orc-extensions from extensions list in my common properties but still getting the same for the next one druid-s3-extensions and so on. I somewhere on Google found that repositoryList solved the issue. I did try:
druid.extensions.repositoryList=[ "druid-hdfs-storage", "druid-kafka-indexing-service", "druid-datasketches","druid-s3-extensions", "druid-kafka-indexing-service", "postgresql-metadata-storage", "druid-parquet-extensions", "druid-datasketches", "druid-basic-security"]
Now, I did not get error, but its not able to connect too Postgres Metadata and giving error:
2021-04-01T14:14:06,926 ERROR [main] org.apache.druid.cli.CliCoordinator - Error when starting up. Failing.
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Unknown provider[postgresql] of Key[type=org.apache.druid.metadata.MetadataStorageProvider, annotation=[none]], known options[[derby]]
at org.apache.druid.guice.PolyBind.createChoiceWithDefault(PolyBind.java:109) (via modules: com.google.inject.util.Modules$OverrideModule -> com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule)
while locating org.apache.druid.metadata.MetadataStorageProvider
while locating org.apache.druid.metadata.MetadataStorage
and when I dont give extension.loadList in common.runtime.properties, it is trying to load all the extensions and then giving error:
Exception in thread "main" java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) No implementation for org.apache.druid.query.QuerySegmentWalker was bound.
while locating com.google.inject.Provider<org.apache.druid.query.QuerySegmentWalker>
for the 1st parameter of org.apache.druid.query.movingaverage.MovingAverageQueryToolChest.<init>(MovingAverageQueryToolChest.java:61)
at org.apache.druid.query.movingaverage.MovingAverageQueryModule.configure(MovingAverageQueryModule.java:48) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.query.movingaverage.MovingAverageQueryModule)
2) No implementation for org.apache.druid.client.TimelineServerView was bound.
while locating org.apache.druid.client.TimelineServerView
for the 1st parameter of org.apache.druid.query.materializedview.DataSourceOptimizer.<init>(DataSourceOptimizer.java:62)
at org.apache.druid.query.materializedview.MaterializedViewSelectionDruidModule.configure(MaterializedViewSelectionDruidModule.java:55) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.query.materializedview.MaterializedViewSelectionDruidModule)
3) No implementation for org.apache.druid.query.QueryToolChestWarehouse was bound.
while locating org.apache.druid.query.QueryToolChestWarehouse
for the 1st parameter of org.apache.druid.query.materializedview.MaterializedViewQueryQueryToolChest.<init>(MaterializedViewQueryQueryToolChest.java:48)
at org.apache.druid.query.materializedview.MaterializedViewSelectionDruidModule.configure(MaterializedViewSelectionDruidModule.java:52) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.query.materializedview.MaterializedViewSelectionDruidModule)
4) No implementation for org.apache.druid.server.log.RequestLogger was bound.
while locating org.apache.druid.server.log.RequestLogger
for the 2nd parameter of org.apache.druid.query.movingaverage.MovingAverageQueryToolChest.<init>(MovingAverageQueryToolChest.java:61)
at org.apache.druid.query.movingaverage.MovingAverageQueryModule.configure(MovingAverageQueryModule.java:48) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.query.movingaverage.MovingAverageQueryModule)
5) A binding to com.google.common.base.Supplier<org.apache.druid.server.audit.SQLAuditManagerConfig> was already configured at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:151) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule).
at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:151) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.postgresql.PostgreSQLMetadataStorageModule)
6) A binding to com.google.common.base.Supplier<org.apache.druid.server.audit.SQLAuditManagerConfig> was already configured at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:151) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule).
at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:151) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.sqlserver.SQLServerMetadataStorageModule)
7) A binding to org.apache.druid.server.audit.SQLAuditManagerConfig was already configured at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:152) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule).
at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:152) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.postgresql.PostgreSQLMetadataStorageModule)
8) A binding to org.apache.druid.server.audit.SQLAuditManagerConfig was already configured at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:152) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule).
at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:152) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.metadata.storage.sqlserver.SQLServerMetadataStorageModule)

googlecloudpubsub:java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

I am facing this issue when trying to run a google cloud subscriber within a scala sbt project on local windows environment. The versions used are as follows:
java : 1.8.0_171"
scala : 2.11.8
below are the versions of sbt library dependencies:
"com.google.cloud" % "google-cloud-pubsub" % "1.108.1",
"com.google.cloud" % "google-cloud-shared-dependencies" % "0.8.6" pomOnly(),
"com.google.api.grpc" % "grpc-google-cloud-pubsub-v1" % "1.90.1",
"io.grpc" % "grpc-all" % "1.30.2"
The deployment is done by running a fat JAR in nohup build using sbt assembly plugin.
This is the error log which I am getting:
Caused by: java.lang.IllegalStateException: Expected the service InnerService [FAILED] to be RUNNING, but the service has FAILED
at com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:366)
at com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:302)
at com.google.api.core.AbstractApiService.awaitRunning(AbstractApiService.java:96)
at services.externalservices.pubsub.GoogleCloudSubscriber$class.subscribeAsyncExample(GoogleCloudSubscriber.scala:89)
at services.externalservices.pubsub.GoogleCloudSubscriber$class.initialise(GoogleCloudSubscriber.scala:37)
at services.externalservices.pubsub.GoogleCloudSubscriberImpl.initialise(GoogleCloudSubscriber.scala:95)
at services.externalservices.pubsub.GoogleCloudSubscriber$class.$init$(GoogleCloudSubscriber.scala:27)
at services.externalservices.pubsub.GoogleCloudSubscriberImpl.<init>(GoogleCloudSubscriber.scala:95)
at services.externalservices.pubsub.GoogleCloudSubscriberImpl$$FastClassByGuice$$a4a053ae.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
at com.google.inject.internal.ConstructorBindingImpl$Factory .get(ConstructorBindingImpl.java:268)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
... 9 more
Caused by: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:233)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:144)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:93)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:414)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:513)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:314)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1600(InstantiatingGrpcChannelProvider.java:71)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:210)
at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:217)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:200)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:156)
at com.google.cloud.pubsub.v1.stub.GrpcSubscriberStub.create(GrpcSubscriberStub.java:272)
at com.google.cloud.pubsub.v1.Subscriber.doStart(Subscriber.java:273)
at com.google.api.core.AbstractApiService$InnerService.doStart(AbstractApiService.java:148)
at com.google.common.util.concurrent.AbstractService.startAsync(AbstractService.java:248)
at com.google.api.core.AbstractApiService.startAsync(AbstractApiService.java:120)
at com.google.cloud.pubsub.v1.Subscriber.startAsync(Subscriber.java:265)
However, the same subscriber works as expected when running the application in foreground using sbt run command.

All connection pools fail to initialize when one connection pool fails to initialize

Is it a bug?
I am using Playframework 2.6.6 with scala 2.12.3. I have 3 databases defined in application.conf ( the settings for the hikaricp connection pools are all over the map because I experimented with them):
db {
mentions {
driver="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/mentions"
password="***"
username="play"
hikaricp {
maximumPoolSize = 2
minimumIdle=2
}
}
postgres {
driver="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres"
password="***"
username="postgres"
hikaricp {
maximumPoolSize = 9
minimumIdle=9
}
}
sqlserver {
driver="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://10.211.55.5:1433/db"
username="sa"
password="***"
hikaricp {
maximumPoolSize=4
minimumIdle=4
//connectionTestQuery="select 1"
}
}
}
With this configuration the Hikaricp connection pool fails to initialize the sql server connection pool and actually none of the other two connection pools are initialized. The fix for the sql server connection error is to set the connectionTestQuery. That's not the point of this post. I don't understand why the other two connections fail when this one fails. In my mind the other two connection pools should still function.
Here are the error messages from the console:
[info] application - Creating Pool for datasource 'sqlserver'
[error] c.z.h.p.PoolBase - HikariPool-1 - Failed to execute isValid() for connection, configure connection test query (null).
[info] application - Creating Pool for datasource 'sqlserver'
[error] c.z.h.p.PoolBase - HikariPool-2 - Failed to execute isValid() for connection, configure connection test query (null).
[info] application - Creating Pool for datasource 'sqlserver'
[error] c.z.h.p.PoolBase - HikariPool-3 - Failed to execute isValid() for connection, configure connection test query (null).
[error] application -
! #761fipg95 - Internal server error, for (GET) [/] ->
play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:
1) Error injecting method, java.lang.AbstractMethodError
at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
at play.api.db.DBModule$$anonfun$$lessinit$greater$1.$anonfun$new$1(DBModule.scala:25):
Binding(interface play.api.db.Database qualified with QualifierInstance(#play.db.NamedDatabase(value=sqlserver)) to ProviderTarget(play.api.db.NamedDatabaseProvider#65c05a8b)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
2) Error injecting method, java.lang.AbstractMethodError
at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
at play.api.db.DBModule$$anonfun$$lessinit$greater$1.$anonfun$new$1(DBModule.scala:25):
Binding(interface play.api.db.Database qualified with QualifierInstance(#play.db.NamedDatabase(value=mentions)) to ProviderTarget(play.api.db.NamedDatabaseProvider#700c1d35)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
3) Error injecting method, java.lang.AbstractMethodError
at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
at play.api.db.DBModule$$anonfun$$lessinit$greater$1.$anonfun$new$1(DBModule.scala:25):
Binding(interface play.api.db.Database qualified with QualifierInstance(#play.db.NamedDatabase(value=postgres)) to ProviderTarget(play.api.db.NamedDatabaseProvider#1f4f0047)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
3 errors]
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:186)
at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124)
at play.core.server.AkkaHttpServer.modelConversion(AkkaHttpServer.scala:183)
at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:189)
at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$3(AkkaHttpServer.scala:106)
at akka.stream.impl.fusing.MapAsync$$anon$23.onPush(Ops.scala:1172)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:499)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:462)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:368)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:571)
Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting method, java.lang.AbstractMethodError
at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
at play.api.db.DBModule$$anonfun$$lessinit$greater$1.$anonfun$new$1(DBModule.scala:25):
Binding(interface play.api.db.Database qualified with QualifierInstance(#play.db.NamedDatabase(value=sqlserver)) to ProviderTarget(play.api.db.NamedDatabaseProvider#65c05a8b)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
2) Error injecting method, java.lang.AbstractMethodError
at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
at play.api.db.DBModule$$anonfun$$lessinit$greater$1.$anonfun$new$1(DBModule.scala:25):
Binding(interface play.api.db.Database qualified with QualifierInstance(#play.db.NamedDatabase(value=mentions)) to ProviderTarget(play.api.db.NamedDatabaseProvider#700c1d35)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
3) Error injecting method, java.lang.AbstractMethodError
at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
at play.api.db.DBModule$$anonfun$$lessinit$greater$1.$anonfun$new$1(DBModule.scala:25):
Binding(interface play.api.db.Database qualified with QualifierInstance(#play.db.NamedDatabase(value=postgres)) to ProviderTarget(play.api.db.NamedDatabaseProvider#1f4f0047)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
3 errors
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:176)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
at com.google.inject.Guice.createInjector(Guice.java:99)
at com.google.inject.Guice.createInjector(Guice.java:84)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:185)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:137)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.DevServerStart$$anon$1.$anonfun$reload$3(DevServerStart.scala:174)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
Caused by: java.lang.AbstractMethodError: null
at net.sourceforge.jtds.jdbc.JtdsConnection.isValid(JtdsConnection.java:2833)
at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(PoolBase.java:456)
at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolBase.java:423)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:381)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:205)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:448)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:519)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:113)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:72)
at play.api.db.HikariCPConnectionPool.$anonfun$create$1(HikariCPModule.scala:51)
An update: I still think that architecturally, if one connection pool doesn't work, the other connections pools should not be affected. Today I shutdown my windows vm running sql server and I had only my postgresql server running. The page I tested connected only to the postgresql dbs and it still failed because the sql server connect pool didn't work. This time it failed with a configuration error java.sql.SQLException - Login Timed out.
After doing some debugging in 2.6.6 & 2.6.7, I discovered the following:
java.lang.AbstractMethodError inherits java.lang.IncompatibleClassChangeError which inherits java.lang.LinkageError. java.lang.LinkageError is considered fatal according to the NonFatal object:
object NonFatal {
/**
* Returns true if the provided `Throwable` is to be considered non-fatal, or false if it is to be considered fatal
*/
def apply(t: Throwable): Boolean = t match {
// VirtualMachineError includes OutOfMemoryError and other fatal errors
case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError | _: ControlThrowable => false
case _ => true
}
/**
* Returns Some(t) if NonFatal(t) == true, otherwise None
*/
def unapply(t: Throwable): Option[Throwable] = if (apply(t)) Some(t) else None
}
So the Try calls sprinkled all over the code don't catch this exception.
The exception ends up being handled by the guice layers. The call goes back to the guice Initializer.injectAll method which (among other objects) injects the NamedDatabaseProvider objects for each database connection configured in the application.conf file (the binding to the NamedDatabaseProvider is wired in the the DBModule). The NamedDatabaseProvider objects depend on DBApi whose initialization fails every time due to the AbstractMethodError exception which is considered fatal.
Ultimately the problem is a combination of circumstances: 1. the exception throws in the Hikaricp code is fatal, 2. The DBApi code wants to initialize all connection pools and it doesn't handle fatal errors.
I don't consider this a bug. Perhaps the Hickaricp dudes could have thrown an UnsupportedOperationException or something similar.
For others interested I found this: https://github.com/njlg/playdb.

Injecting the current App in Play 2.5.2

I am using the DI to access my App in Play 2.5:
import com.google.inject.{Inject, Provider}
import play.api.mvc._
import play.api.Application
class ApplicationController #Inject()(p: Provider[Application]) extends Controller {
implicit lazy val app = p.get()
println(app.hashCode()+"") // Random line to use the injected app
}
I am getting the following error :
ProvisionException: Unable to provision, see the following errors:
1) Tried proxying play.api.Application to support a circular dependency, but circular proxies are disabled. ...
I went on the Play Migration guide : https://www.playframework.com/documentation/2.5.x/Migration25#Handling-legacy-components
and did as they say to avoid circular dependency, however I still have that error.
I've also found a variable called disableCircularProxies which I am not currently using (http://google.github.io/guice/api-docs/latest/api-diffs/changes/docdiffs_com.google.inject.html) as I am not sure how to do so and found very little info about it.
Any idea how to solve this circular dependency error ?
Here is the full stack trace :
Tried proxying play.api.Application to support a circular dependency, but circular proxies are disabled.
at play.api.DefaultApplication.class(Application.scala:221)
while locating play.api.DefaultApplication
while locating play.api.Application
at myCustomProject.controllers.ApplicationController.<init>(ApplicationController.scala:9)
while locating myCustomProject.controllers.ApplicationController
for parameter 1 at router.Routes.<init>(Routes.scala:31)
while locating router.Routes
while locating play.api.inject.RoutesProvider
while locating play.api.routing.Router
for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:200)
while locating play.api.http.JavaCompatibleHttpRequestHandler
while locating play.api.http.HttpRequestHandler
for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:221)
at play.api.DefaultApplication.class(Application.scala:221)
while locating play.api.DefaultApplication
while locating play.api.Application
Ultimately, I shouldn't be using this Provider[Application] but rather the configuration, environment, ... from the App.
It's just that according to the doc, I should be able to have that working.
Java Version:
#Inject
private Provider<Application> application;
private void someMethod {
...
application.get();
}

sorm h2 DB for play framework scala - NoSuchMethodError

I'm encountering this error when I followed play-scala template tutorial:
[error] play - Cannot invoke the action, eventually got an error: java.lang.RuntimeException: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
[error] application -
! #6jmiof8bp - Internal server error, for (POST) [/provision] ->
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.4.jar:2.3.4]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.4.jar:2.3.4]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.4.jar:2.3.4]
at scala.Option.map(Option.scala:145) [scala-library-2.11.1.jar:na]
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:523) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.11-2.3.4.jar:2.3.4]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) ~[play_2.11-2.3.4.jar:2.3.4]
Caused by: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
at sorm.reflection.ScalaApi$TypeApi.members(ScalaApi.scala:11) ~[sorm-0.3.13.jar:na]
at sorm.reflection.ScalaApi$TypeApi.properties(ScalaApi.scala:13) ~[sorm-0.3.13.jar:na]
at sorm.reflection.Reflection.properties(Reflection.scala:31) ~[sorm-0.3.13.jar:na]
at sorm.core.Initialization$.sorm$core$Initialization$$checkType$1(Initialization.scala:75) ~[sorm-0.3.13.jar:na]
at sorm.core.Initialization$.recursiveEntities$1(Initialization.scala:79) ~[sorm-0.3.13.jar:na]
I encounter this error when I added this line DB.save(person) on my provision method Application.scala
My DB Object looks like this:
object MemDB extends Instance(entities = Seq(Entity[Person]()), url ="jdbc:h2:mem:play") {}
I also removed the comments on my application.conf file
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
I can't figure out how to fix this error. I just followed the video tutorial in the playframework websito for play framework and scala. I also tried changing the url to jdbc:h2:mem:test just like what the tutorial suggest. I am using the following versions
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.4")
libraryDependencies += "org.sorm-framework" % "sorm" % "0.3.13"
libraryDependencies += "com.h2database" % "h2" % "1.4.181"
scalaVersion := "2.11.1"
SORM is only compatible with the version 2.1 of Play at the time. Your problems must be caused by this.
Here's a related ticket.