Open wei-hai opened 7 years ago
Hello @wei-hai, could you please provide a small project that shows this problem? I was not able to reproduce this.
Also, the mailing list would be a better place to discuss this. Github issues are for reporting bugs and feature requests in Play, not for general discussion and getting help. So, if this is more a doubt than a reproducible bug, I encourage you to move the discussion to the mailing list.
I'm having this exact same problem using 2.6. Did you guys ever find out what was going on?
For me too, after removing one of the parameters from initialization command the error was gone. To reproduce this you can use this project https://github.com/joaocraveiro/versus. I've deployed it on heroku as it is and it throws the error. If you remove "-Ddb.default.url=${DATABASE_URL}" from the Procfile it's gone.
I have the same problem than seems I switched to Play 2.6.0-RC2 and Ebean 4.0.0-M3. The error seems more "random" to me, because it happens randomly in development and in prod...
2017-06-08 15:57:09,368 [INFO] from application in main - Creating Pool for datasource 'default' 2017-06-08 15:57:09,422 [WARN] from com.zaxxer.hikari.HikariConfig in main - The initializationFailFast propery is deprecated, see initializationFailTimeout 2017-06-08 15:57:09,860 [INFO] from play.api.db.DefaultDBApi in main - Database [default] connected at jdbc:mysql:///?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC 2017-06-08 15:57:13,558 [ERROR] from io.ebean.Ebean in application-akka.actor.default-dispatcher-6 - Error trying to create the default EbeanServer java.lang.RuntimeException: DataSource user is null? at org.avaje.datasource.pool.ConnectionPool.
(ConnectionPool.java:204) at org.avaje.datasource.Factory.createPool(Factory.java:12) at io.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:310) at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:265) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:108) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:79) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:44) at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:55) at io.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:201) at io.ebean.Ebean$ServerManager. (Ebean.java:159) at io.ebean.Ebean$ServerManager. (Ebean.java:124) at io.ebean.Ebean. (Ebean.java:118) at io.ebean.Finder.db(Finder.java:101) at io.ebean.Finder.query(Finder.java:157) at modules.testregistration.RemoveTestRegistrationActor.onReceive(RemoveTestRegistrationActor.java:22) at akka.actor.UntypedAbstractActor$$anonfun$receive$1.applyOrElse(AbstractActor.scala:243) at akka.actor.Actor.aroundReceive(Actor.scala:513) at akka.actor.Actor.aroundReceive$(Actor.scala:511) at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:132) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527) at akka.actor.ActorCell.invoke(ActorCell.scala:496) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) at akka.dispatch.Mailbox.run(Mailbox.scala:224) at akka.dispatch.Mailbox.exec(Mailbox.scala:234) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Uncaught error from thread [application-akka.actor.default-dispatcher-6] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application] java.lang.ExceptionInInitializerError at io.ebean.Finder.db(Finder.java:101) at io.ebean.Finder.query(Finder.java:157) at modules.testregistration.RemoveTestRegistrationActor.onReceive(RemoveTestRegistrationActor.java:22) at akka.actor.UntypedAbstractActor$$anonfun$receive$1.applyOrElse(AbstractActor.scala:243) at akka.actor.Actor.aroundReceive(Actor.scala:513) at akka.actor.Actor.aroundReceive$(Actor.scala:511) at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:132) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527) at akka.actor.ActorCell.invoke(ActorCell.scala:496) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) at akka.dispatch.Mailbox.run(Mailbox.scala:224) at akka.dispatch.Mailbox.exec(Mailbox.scala:234) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: DataSource user is null? at io.ebean.Ebean$ServerManager. (Ebean.java:164) at io.ebean.Ebean$ServerManager. (Ebean.java:124) at io.ebean.Ebean. (Ebean.java:118) ... 16 more Caused by: java.lang.RuntimeException: DataSource user is null? at org.avaje.datasource.pool.ConnectionPool. (ConnectionPool.java:204) at org.avaje.datasource.Factory.createPool(Factory.java:12) at io.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:310) at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:265) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:108) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:79) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:44) at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:55) at io.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:201) at io.ebean.Ebean$ServerManager. (Ebean.java:159) ... 18 more 2017-06-08 15:57:13,588 [ERROR] from akka.actor.ActorSystemImpl in application-akka.actor.default-dispatcher-5 - Uncaught error from thread [application-akka.actor.default-dispatcher-6] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled 2017-06-08 15:57:13,599 [INFO] from akka.actor.CoordinatedShutdown in application-akka.actor.default-dispatcher-5 - Starting coordinated shutdown from JVM shutdown hook
Hi,
I was not able to reproduce it using Play 2.6.0 RC2 and play-ebean 4.0.0-RC1. Here are the changes that I've made to https://github.com/joaocraveiro/versus:
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 624e4c5..f281054 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,4 +1,4 @@
// The Play plugin
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.0-M5")
+addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.0-RC2")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
-addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "4.0.0-M3")
+addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "4.0.0-RC1")
After that:
export PORT=9000
export DATABASE_URL="jdbc:postgresql://localhost/issue_7017"
export JDBC_DATABASE_USERNAME=postgres
export JDBC_DATABASE_PASSWORD=dummy
export JDBC_DATABASE_URL="jdbc:postgresql://localhost/issue_7017"
sbt clean stage
foreman start
And I get the application running:
17:58:48 web.1 | started with pid 37604
17:58:50 web.1 | [info] application - Creating Pool for datasource 'default'
17:58:50 web.1 | [warn] c.z.h.HikariConfig - The initializationFailFast propery is deprecated, see initializationFailTimeout
17:58:50 web.1 | [info] p.a.d.DefaultDBApi - Database [default] connected at jdbc:h2:mem:play_env
17:58:51 web.1 | [info] application - Starting module...
17:58:51 web.1 | [info] application - Profiles: 1
17:58:51 web.1 | [warn] o.h.v.m.ParameterMessageInterpolator - HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
17:58:51 web.1 | [info] play.api.Play - Application started (Prod)
17:58:51 web.1 | [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
@joaocraveiro do you have environment variables for JDBC_DATABASE_USERNAME
and JDBC_DATABASE_PASSWORD
when running locally? Can you confirm that all the evolutions could be successfully applicated to your database?
You can better figure out what is happening in your application by adding the following conf/loback.xml
file:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!-- We use short exception stack trace logging to limit output for travis. -->
<!-- Change to full if you need to do further debugging, but never commit that. -->
<pattern>%level %logger{15} - %message%n%ex{short}</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@wei-hai and @Flo354 could you also please try with the new versions of Play and play-ebean and with a more verbose log?
@marcospereira evolutions were ok and yes I do have those variables but never had the problem running locally (maybe because I don't use any variables in the command to start the server locally, I read them all from the conf file, while on Heroku I need to so it can bind the database configs automatically). I'd guess it was a problem with either the length of the start command or a conflict between variables in both the start command and in the conf file.
@marcospereira please explain this line:
[warn] o.h.v.m.ParameterMessageInterpolator - HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
I see it in my console, and I don't know what does it mean
I found and fixed the problem for my crash. There were conflicts with versions...
Solved by doing this in my build.sbt
libraryDependencies ++= Seq(
...
"com.typesafe.play" % "play-jdbc_2.12" % "2.6.0-RC2",
"com.typesafe.play" % "play-jdbc-api_2.12" % "2.6.0-RC2",
"com.typesafe.play" % "play-jdbc-evolutions_2.12" % "2.6.0-RC2",
"com.typesafe.play" % "play-java-jdbc_2.12" % "2.6.0-RC2"
)
dependencyOverrides ++= Set(
"com.typesafe.play" % "play-jdbc_2.12" % "2.6.0-RC2",
"com.typesafe.play" % "play-jdbc-api_2.12" % "2.6.0-RC2",
"com.typesafe.play" % "play-jdbc-evolutions_2.12" % "2.6.0-RC2",
"com.typesafe.play" % "play-java-jdbc_2.12" % "2.6.0-RC2"
)
@PromanSEW This warning is from Hibernate Validator. We removed the javax.el-api
dependency in playframework/playframework#6805 because we did not make use EL interpolation anyway. It will not affect you. Actually we could disable the warning to not confuse people...
@Flo354 this was happening because play-ebean was bringing the wrong (old) Play dependencies. This should be working now since it is depending on the right Play version.
I'm closing this issue.
The error surfaced again (play 2.6.2)...
I did not have the problem when starting the project in dev mode but when I pushed the app to my production servers, it did not work. Still the same "Error trying to create the default EbeanServer" with : java.lang.RuntimeException: DataSource user is null?
Here is the stack trace from CloudWatch :
2017-07-26 10:21:31,100 [ERROR] from io.ebean.Ebean in application-akka.actor.default-dispatcher-3 - Error trying to create the default EbeanServer java.lang.RuntimeException: DataSource user is null? at org.avaje.datasource.pool.ConnectionPool.
(ConnectionPool.java:204) at org.avaje.datasource.Factory.createPool(Factory.java:12) at io.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:310) at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:265) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:108) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:79) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:44) at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:55) at io.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:201) at io.ebean.Ebean$ServerManager. (Ebean.java:159) at io.ebean.Ebean$ServerManager. (Ebean.java:124) at io.ebean.Ebean. (Ebean.java:118) at io.ebean.Finder.db(Finder.java:101) at io.ebean.Finder.query(Finder.java:157) at modules.testregistration.RemoveTestRegistrationActor.onReceive(RemoveTestRegistrationActor.java:23) at akka.actor.UntypedAbstractActor$$anonfun$receive$1.applyOrElse(AbstractActor.scala:243) at akka.actor.Actor.aroundReceive(Actor.scala:513) at akka.actor.Actor.aroundReceive$(Actor.scala:511) at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:132) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527) at akka.actor.ActorCell.invoke(ActorCell.scala:496) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) at akka.dispatch.Mailbox.run(Mailbox.scala:224) at akka.dispatch.Mailbox.exec(Mailbox.scala:234) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) 2017-07-26 10:21:31,120 [ERROR] from akka.actor.ActorSystemImpl in application-akka.actor.default-dispatcher-8 - Uncaught error from thread [application-akka.actor.default-dispatcher-3]: null, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application] java.lang.ExceptionInInitializerError: null at io.ebean.Finder.db(Finder.java:101) at io.ebean.Finder.query(Finder.java:157) at modules.testregistration.RemoveTestRegistrationActor.onReceive(RemoveTestRegistrationActor.java:23) at akka.actor.UntypedAbstractActor$$anonfun$receive$1.applyOrElse(AbstractActor.scala:243) at akka.actor.Actor.aroundReceive(Actor.scala:513) at akka.actor.Actor.aroundReceive$(Actor.scala:511) at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:132) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527) at akka.actor.ActorCell.invoke(ActorCell.scala:496) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) at akka.dispatch.Mailbox.run(Mailbox.scala:224) at akka.dispatch.Mailbox.exec(Mailbox.scala:234) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: DataSource user is null? at io.ebean.Ebean$ServerManager. (Ebean.java:164) at io.ebean.Ebean$ServerManager. (Ebean.java:124) at io.ebean.Ebean. (Ebean.java:118) ... 16 common frames omitted Caused by: java.lang.RuntimeException: DataSource user is null? at org.avaje.datasource.pool.ConnectionPool. (ConnectionPool.java:204) at org.avaje.datasource.Factory.createPool(Factory.java:12) at io.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:310) at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:265) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:108) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:79) at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:44) at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:55) at io.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:201) at io.ebean.Ebean$ServerManager. (Ebean.java:159) ... 18 common frames omitted 2017-07-26 10:21:31,124 [INFO] from play.core.server.AkkaHttpServer in Thread-6 - Stopping server... 2017-07-26 10:21:31,154 [INFO] from akka.actor.CoordinatedShutdown in application-akka.actor.default-dispatcher-8 - Starting coordinated shutdown from JVM shutdown hook 2017-07-26 10:21:33,547 [INFO] from application in Thread-6 - Shutting down connection pool.
EDIT : it seems again that play-ebean bring the old play dependencies... 2.6.0 are presents instead of 2.6.2. Fixed with :
dependencyOverrides ++= Set(
"com.typesafe.play" % "play-jdbc_2.12" % "2.6.2",
"com.typesafe.play" % "play-jdbc-api_2.12" % "2.6.2",
"com.typesafe.play" % "play-jdbc-evolutions_2.12" % "2.6.2",
"com.typesafe.play" % "play-java-jdbc_2.12" % "2.6.2"
)
Try to use sbt update before sbt dist. Maybe that is a cleaner solution instead of the dependencyOverrides approach. That solved it for me. Reproducible on two environments with the same problem.
Try to use sbt update before sbt dist.
That's strange, I would have thought that dist already triggers an update...
I expected it too, but it seems the update is not performed. When you change the dependency versions the files are not copied into the bundle in the correct version (check the lib folder). Only manual dist update solves it. Reproducible with Play 2.6.x on two systems.
Been facing this for a while, and it happens really randomly too, but the above responses did not help me but instead, updating the sbt-play-ebean
plugin made it work for me:
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "4.0.3")
in plugins.sbt
I think this should be reopened because these random fixes + it still happening randomly means it must be more then just dependency issues. I know its flaky and only reproducible for a selected few so I don't know how to approach it :/
Update: Specifically, doing sbt update
and the dependencies override did not work for me
After banging my head against this issue for way too long, I have a theory. This is running play 2.6.7, but I think it probably applies to earlier versions as well.
The DataSource user is null?
message gets printed when creating an EbeanServer
. EbeanServer
instances are created, and registered, through the static Ebean
class.
The Play framework (at least in most examples) tries to create EbeanServers according to application config in EbeanDynamicEvolutions
. This happens in the constructor, which is called by Guice (again, at least in most examples).
The thing that I think bites many people is that the examples, Ebean.getServer(name)
is called in the constructor of Repository classes (e.g. CompanyRepository.java). This is again, called by Guice. The important thing here is that the getServer(name)
method will try to create the ebean server if it does not exist.
Since, afaik, Guice has no pre-defined order when instantiating classes, the repository class might be created before the EbeanDynamicEvolutions
instance. This leads to the repository class trying to create a server without any config, and thus the error. Since this depends on the rather arbitrary guice injection order + timing, a lot of the weird 'causes' in the comments above kind of makes sense.
I have been able to make this error stop happening by starting to use the Ebean.getServer(name)
when accessing the database, instead of in repository constructors. E.g:
public class UserRepository {
private final String ebeanServer;
private final DatabaseExecutionContext executionContext;
@Inject
public UserRepository(EbeanConfig ebeanConfig, DatabaseExecutionContext executionContext) {
this.ebeanServer = ebeanConfig.defaultServer();
this.executionContext = executionContext;
}
public CompletionStage<Void> insert(User user) {
return supplyAsync(
() -> {
Ebean.getServer(ebeanServer).insert(user);
return null;
},
executionContext);
}
}
I believe that either the docs should be updated with this, or that the race condition at DI should be resolved somehow. I don't know which though :wink:
Reading up on the original reporter's issue, I think that my 'theory' was for a different bug than what was originally reported, but with the same symptoms. Might still be valid for others though.
In addition to @antonha answer, his solution didn't entirely work in my case. I'm posting this to help others with similar bug. (play 2.6.7, sbt-play-ebean 4.0.6, scala 2.12.4)
I think @antonha is right about the race condition, so I started ebean server from guice module.
My application.conf
looks something like this:
db.default.driver = ...
db.default.url = ...
db.default.username = ...
db.default.password = ...
ebean.default = ["models.*"]
And here's the module:
public class Module extends AbstractModule {
private final Environment environment;
private final Config config;
public Module(
Environment environment,
Config config
) {
this.environment = environment;
this.config = config;
}
@Override
protected void configure() {
ServerConfig ebeanConfig = new ServerConfig();
DataSourceConfig db = new DataSourceConfig();
db.setDriver(config.getString("db.default.driver"));
db.setUsername(config.getString("db.default.username"));
db.setPassword(config.getString("db.default.password"));
db.setUrl(config.getString("db.default.url"));
ebeanConfig.setDefaultServer(true);
ebeanConfig.setDataSourceConfig(db);
EbeanServerFactory.create(ebeanConfig);
// ... rest of the bindings
}
}
Essentially it's not loading the EbeanDynamicEvolutions if you create your repository class like this you can make it work
private final EbeanServer ebeanServer;
private final DatabaseExecutionContext executionContext;
private final EbeanDynamicEvolutions ebeanDynamicEvolutions;
@Inject
public YourRepository(EbeanConfig ebeanConfig, EbeanDynamicEvolutions ebeanDynamicEvolutions, DatabaseExecutionContext executionContext) {
this.ebeanDynamicEvolutions = ebeanDynamicEvolutions;
this.ebeanServer = Ebean.getServer(ebeanConfig.defaultServer());
this.executionContext = executionContext;
}
Taken from in here :: https://github.com/playframework/play-ebean/issues/51
Can confirm, this still occurs with Play 2.6.11. Should be reopened.
@dimonok The error appeared again in my system after updating Play. But the advice by @rowanl solved the problem (for me).
This is a really huge problem that needs to be solved. Also occuring on Play 2.6.12 and play-ebean 4.1.0. Even in development mode sometimes. In development mode it helps by restarting the MySQL server and then compile the app again. After that it works. But that's not possible in a live environment.
Confirmed. It is still happening with Play 2.6.12 and play-ebean 4.1.0. Last solution from @rowanl worked, however it is still workaround.
Reopening since there are multiple reports against new versions of Play and play-ebean.
On my MacBook Pro 2017 my Play 2.6.12 App has the mentioned problems using play-ebean 4.1.0. On this machine it helped downgrading to 4.0. On a Linux machine it's the other way around. The same code showed the known problems, but on this machine upgrading to play-ebean 4.1.0 helped.
@GBeushausen thank you for the additional information.
Occurred again in production environment. Not reproducible on dev environment. @rowanl workaround is not working.
Play 2.6.12. sbt-play-ebean 4.0.6
ebean configuration:
allQuotedIdentifiers=true
namingconvention=io.ebean.config.MatchingNamingConvention
ebean.default = [
"com.company.product1.twitch.persistence.*",
...
]
Logs: https://gist.github.com/dimonok/eb59e16dd3e47e571876ddb174b6e755
Applied @rowanl's workaround to all of my repositories, now the app is starting again in production environment.
I just solved this error by change db.default.user to db.default.username. I hope this helps
I still have the error with play 2.6.13 and play ebean 4.1.0 (no errors with 4.0.6). But I have the error in development.
See my issue on the play-ebean repo: https://github.com/playframework/play-ebean/issues/145
We had the same problem using play 2.6.13, play-ebean 4.1.0.
This issue only happens publishing with docker (dockerBaseImage := "openjdk:8-jre-slim"
), but this does not happen in dev mode ~or publishing with stage~.
~However, if we fix the version of akka-actor and akka-stream to 2.5.9, then it works for us.~
dependencyOverrides += "com.typesafe.akka" %% "akka-actor" % "2.5.9"
dependencyOverrides += "com.typesafe.akka" %% "akka-stream" % "2.5.9"
~We had fixed versions before because playframework/playframework#7832, but this seem as a dependency problem of play-ebean with akka maybe?~
Edit: An update 7 days later. This issue is very random, now this happened again even publishing with stage.
Edit2: for now, injecting EbeanDynamicEvolutions ebeanDynamicEvolutions
as @rowanl suggested seem to works, thank you!
We achieve this injecting that class into DatabaseExecutionContext
(a class used in the ebean example project), so there was only one file we needed to change.
If this is a race condition caused by a wrong injection with guice... we are considering to change our project to use dagger2 instead. It is so annoying how you cant be sure that your code will works as always because of runtime errors.
I just fixed my problem. I have two databases, db.development
and db.production
.
While, this page https://www.playframework.com/documentation/2.6.x/JavaEbean tells:
This defines a default Ebean server, using the default data source, which must be properly configured. You can also override the name of the default Ebean server by configuring ebeanconfig.datasource.default property
The property to define is not ebeanconfig.datasource.default
but play.ebean.defaultDatasource
Found this here: https://stackoverflow.com/a/31070658
Applied @rowanl's workaround to all of my repositories, now the app is starting again in production environment.
We have been injecting databaseExecutionContext throughout our code for maintaining a threadpool for database connections. Just injected EbeanDynamicEvolutions into databaseExecutionContext and it worked. Quick fix to avoid dealing with multiple classes.
Confirming that I see this issue in Play 2.7.3 + play-ebean 5.0.0
CloudWatch logs:
[warn] - 2019-11-22 07:03:44.985 [main] WARN p.a.i.guice.GuiceApplicationBuilder [application] - Logger configuration in conf files is deprecated and has no effect. Use a logback configuration file instead.
[info] - 2019-11-22 07:03:46.845 [main] INFO play.api.db.DefaultDBApi [p.a.d.DefaultDBApi] - Database [default] initialized at jdbc:postgresql://bts-dev-statements.cqodsdik3jmp.us-west-2.rds.amazonaws.com:5432/statement
[info] - 2019-11-22 07:03:46.864 [main] INFO play.api.db.HikariCPConnectionPool [application] - Creating Pool for datasource 'default'
[warn] - 2019-11-22 07:03:48.777 [main] WARN play.api.http.HttpConfiguration$ [p.a.h.HttpConfiguration] -
Your secret key is very short, and may be vulnerable to dictionary attacks. Your application may not be secure.
The application secret should ideally be 32 bytes of completely random input, encoded in base64.
To set the application secret, please read http://playframework.com/documentation/latest/ApplicationSecret
[warn] - 2019-11-22 07:03:50.330 [main] WARN play.api.i18n.DefaultLangsProvider [application] - application.langs is deprecated, use play.i18n.langs instead
Oops, cannot start the server.
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, io.ebean.datasource.DataSourceConfigurationException: DataSource user is null?
at repositories.InterchangeEbean.<init>(InterchangeEbean.java:25)
while locating repositories.InterchangeEbean
for the 3rd parameter of controllers.StatementsController.<init>(StatementsController.java:45)
while locating controllers.StatementsController
for the 2nd parameter of router.Routes.<init>(Routes.scala:30)
while locating router.Routes
while locating play.api.inject.RoutesProvider
while locating play.api.routing.Router
for the 3rd parameter of play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:279)
while locating play.api.http.JavaCompatibleHttpRequestHandler
while locating play.api.http.HttpRequestHandler
for the 6th parameter of play.api.DefaultApplication.<init>(Application.scala:240)
at play.api.DefaultApplication.class(Application.scala:239)
while locating play.api.DefaultApplication
while locating play.api.Application
Caused by: io.ebean.datasource.DataSourceConfigurationException: DataSource user is null?
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:228)
at io.ebean.datasource.core.Factory.createPool(Factory.java:15)
at io.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:273)
at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:217)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:103)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:69)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:35)
at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:58)
at io.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:213)
at io.ebean.Ebean$ServerManager.get(Ebean.java:200)
at io.ebean.Ebean$ServerManager.access$200(Ebean.java:135)
at io.ebean.Ebean.getServer(Ebean.java:261)
at repositories.InterchangeEbean.<init>(InterchangeEbean.java:26)
at repositories.InterchangeEbean$$FastClassByGuice$$f167814f.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.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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.InjectorImpl$1.get(InjectorImpl.java:1050)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086)
at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:410)
at play.api.inject.ContextClassLoaderInjector.$anonfun$instanceOf$3(Injector.scala:119)
at play.api.inject.ContextClassLoaderInjector.withContext(Injector.scala:127)
at play.api.inject.ContextClassLoaderInjector.instanceOf(Injector.scala:119)
at play.api.inject.RoutesProvider.$anonfun$get$2(BuiltinModule.scala:109)
at scala.Option.fold(Option.scala:251)
at play.api.inject.RoutesProvider.get$lzycompute(BuiltinModule.scala:109)
at play.api.inject.RoutesProvider.get(BuiltinModule.scala:105)
at play.api.inject.RoutesProvider.get(BuiltinModule.scala:104)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:85)
at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:77)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:59)
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:61)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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.FactoryProxy.get(FactoryProxy.java:62)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:211)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:182)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
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:186)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:139)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:57)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
2) Error injecting constructor, io.ebean.datasource.DataSourceConfigurationException: DataSource user is null?
at repositories.InterchangeEbean.<init>(InterchangeEbean.java:25)
while locating repositories.InterchangeEbean
for the 3rd parameter of controllers.StatementsController.<init>(StatementsController.java:45)
while locating controllers.StatementsController
for the 2nd parameter of router.Routes.<init>(Routes.scala:30)
while locating router.Routes
while locating play.api.inject.RoutesProvider
while locating play.api.routing.Router
for the 3rd parameter of play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:279)
while locating play.api.http.JavaCompatibleHttpRequestHandler
while locating play.api.http.HttpRequestHandler
for the 6th parameter of play.api.DefaultApplication.<init>(Application.scala:240)
at play.api.DefaultApplication.class(Application.scala:239)
while locating play.api.DefaultApplication
while locating play.api.Application
for the 1st parameter of play.DefaultApplication.<init>(DefaultApplication.java:34)
at play.DefaultApplication.class(DefaultApplication.java:34)
while locating play.DefaultApplication
while locating play.Application
Caused by: io.ebean.datasource.DataSourceConfigurationException: DataSource user is null?
at io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:228)
at io.ebean.datasource.core.Factory.createPool(Factory.java:15)
at io.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:273)
at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:217)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:103)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:69)
at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:35)
at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:58)
at io.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:213)
at io.ebean.Ebean$ServerManager.get(Ebean.java:200)
at io.ebean.Ebean$ServerManager.access$200(Ebean.java:135)
at io.ebean.Ebean.getServer(Ebean.java:261)
at repositories.InterchangeEbean.<init>(InterchangeEbean.java:26)
at repositories.InterchangeEbean$$FastClassByGuice$$f167814f.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.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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.InjectorImpl$1.get(InjectorImpl.java:1050)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086)
at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:410)
at play.api.inject.ContextClassLoaderInjector.$anonfun$instanceOf$3(Injector.scala:119)
at play.api.inject.ContextClassLoaderInjector.withContext(Injector.scala:127)
at play.api.inject.ContextClassLoaderInjector.instanceOf(Injector.scala:119)
at play.api.inject.RoutesProvider.$anonfun$get$2(BuiltinModule.scala:109)
at scala.Option.fold(Option.scala:251)
at play.api.inject.RoutesProvider.get$lzycompute(BuiltinModule.scala:109)
at play.api.inject.RoutesProvider.get(BuiltinModule.scala:105)
at play.api.inject.RoutesProvider.get(BuiltinModule.scala:104)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:85)
at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:77)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:59)
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:61)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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.FactoryProxy.get(FactoryProxy.java:62)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
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)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:211)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:182)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
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:186)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:139)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:57)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
2 errors
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:543)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
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:186)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:139)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:57)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Am I missing something? This issue is 2 years old and I only see a work-around. I can confirm this is sporadic and unpredictable. Been running without issue for months, and in an instant all of a sudden deployments start failing on startup because of:
java.lang.NoClassDefFoundError: Could not initialize class io.ebean.Ebean
at repository.EbeanServerProvider.get(EbeanServerProvider.java:15)
at repository.EbeanServerProvider.get(EbeanServerProvider.java:8)
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: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.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:110)
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.SingleFieldInjector.inject(SingleFieldInjector.java:54)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:120)
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.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:120)
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.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:120)
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.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:120)
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.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:123)
at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:117)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)
at com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor.java:117)
at com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:79)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:171)
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:201)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:155)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:26)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$1.apply(DevServerStart.scala:182)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$1.apply(DevServerStart.scala:173)
at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1.reload(DevServerStart.scala:173)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1.get(DevServerStart.scala:126)
at play.core.server.AkkaHttpServer.play$core$server$AkkaHttpServer$$handleRequest(AkkaHttpServer.scala:282)
at play.core.server.AkkaHttpServer$$anonfun$4.apply(AkkaHttpServer.scala:174)
at play.core.server.AkkaHttpServer$$anonfun$4.apply(AkkaHttpServer.scala:174)
at akka.stream.impl.fusing.MapAsyncUnordered$$anon$26.onPush(Ops.scala:1376)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:523)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:480)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:376)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:606)
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:485)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:581)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:749)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:764)
at akka.actor.Actor$class.aroundReceive(Actor.scala:539)
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:671)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:612)
at akka.actor.ActorCell.invoke(ActorCell.scala:581)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:268)
at akka.dispatch.Mailbox.run(Mailbox.scala:229)
at akka.dispatch.Mailbox.exec(Mailbox.scala:241)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
323520 ERROR application -
EbeanServerProvider.java
public class EbeanServerProvider implements Provider<EbeanServer> {
@Override
public EbeanServer get() {
return Ebean.getDefaultServer();
}
}
GuiceModule:
bind(EbeanServer.class).toProvider(EbeanServerProvider.class).asEagerSingleton();
application.properties:
db.default.driver="com.mysql.jdbc.Driver"
db.default.url="jdbc:mysql://localhost:3306/db_name?useSSL=false"
db.default.username="dbuser"
db.default.password="dbpass"
play.evolutions.enabled=false
play.evolutions.autoApplyDowns=false
ebean.default=["models.*"]
play.ebean.defaultDatasource = "default"
ebeanconfig.datasource.default = "default"
Hey everyone, is this still a problem with newer Play and play-ebean releases? (also maybe this is a duplicate of #145?)
ahahaha, great timing. I am in process of updating the old project were I got this error back then, just right now. Idk if with the current version of play-ebean 8.2.0 (with ebean 15.x) this would be fixed, but I will be testing for the next weeks to see.
@ErunamoJAZZ Great! Looking forward to your feedback.
Play Version (2.5.x / etc)
2.5.x
API (Scala / Java / Neither / Both)
Java
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
CentOS 7
JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)
openJDK 1.8.x
Library Dependencies
ebean
Expected Behavior
when I run:
The application works well.
However, when I run:
application cannot start.
Please describe the expected behavior of the issue, starting from the first action.
Actual Behavior