lagom与mysql数据库连接

hs1ihplo  于 2021-06-15  发布在  Mysql
关注(0)|答案(1)|浏览(435)

我想把lagom连接到mysql数据库,我下载了一个在lagom网站上创建的项目。我在hello impl pom中添加了以下依赖项,applicationt.conf配置了db细节。

<dependency>
        <groupId>com.lightbend.lagom</groupId>
        <artifactId>lagom-javadsl-persistence-jdbc_${scala.binary.version}</artifactId>
        <version>${lagom.version}</version>
</dependency>

应用程序.conf

db.default {
  driver = "com.mysql.jdbc.Driver"
  url = "jdbc:mysql://localhost:3306/test"
  user = "root"
  password = ""
}
jdbc-defaults.slick.profile = "slick.jdbc.MySQLProfile$"
lagom.persistence.jdbc.create-tables.auto = true

在运行应用程序之后,出现了以下错误。错在哪里。我是新来拉各姆的,请详细解释。

{"name":"akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://hello-impl-application/system/sharding/HelloEntity#976224651]] after [10000 ms]. Message of type [com.lightbend.lagom.javadsl.persistence.CommandEnvelope]. A typical reason for `AskTimeoutException` is that the recipient actor didn't send a reply.","detail":"akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://hello-impl-application/system/sharding/HelloEntity#976224651]] after [10000 ms]. Message of type [com.lightbend.lagom.javadsl.persistence.CommandEnvelope]. A typical reason for `AskTimeoutException` is that the recipient actor didn't send a reply.\r\n\tat akka.pattern.PromiseActorRef$.$anonfun$defaultOnTimeout$1(AskSupport.scala:635)\r\n\tat akka.pattern.PromiseActorRef$.$anonfun$apply$1(AskSupport.scala:650)\r\n\tat akka.actor.Scheduler$$anon$4.run(Scheduler.scala:205)\r\n\tat scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:870)\r\n\tat scala.concurrent.BatchingExecutor.execute(BatchingExecutor.scala:109)\r\n\tat scala.concurrent.BatchingExecutor.execute$(BatchingExecutor.scala:103)\r\n\tat scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:868)\r\n\tat akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(LightArrayRevolverScheduler.scala:328)\r\n\tat akka.actor.LightArrayRevolverScheduler$$anon$4.executeBucket$1(LightArrayRevolverScheduler.scala:279)\r\n\tat akka.actor.LightArrayRevolverScheduler$$anon$4.nextTick(LightArrayRevolverScheduler.scala:283)\r\n\tat akka.actor.LightArrayRevolverScheduler$$anon$4.run(LightArrayRevolverScheduler.scala:235)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\n"}
xxe27gdn

xxe27gdn1#

在使用mysql时,我们需要创建数据库本身。在cassandra中,它在conf文件中定义了一个名称之后创建了keyspace,但是在mysql中,我们必须手动创建一个数据库,比如test在您的案例中->
创建数据库测试;
那么你就不会面临ask超时异常了。

相关问题