Lagom с подключением MySQL Db - PullRequest
       66

Lagom с подключением MySQL Db

0 голосов
/ 17 декабря 2018

Я хочу подключить lagom к MySQL db, загружаю проект, созданный на сайте Lagom.Я добавил следующую зависимость в hello-impl pom, и applicationaiont.conf настроил детали базы данных.

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

aplication.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

после этого я запустил приложение iполучил следующую ошибку.в чем ошибка.Я новичок в Лагоме, поэтому, пожалуйста, объясните подробно.

{"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"}

1 Ответ

0 голосов
/ 15 марта 2019

При использовании MySQL нам нужно создать саму базу данных.В Cassandra он создает пространство ключей после определения имени в файле conf, но в MySQL нам нужно вручную создать базу данных скажем test в вашем случае ->

создайте тест базы данных;

тогда вы не столкнетесь с исключением истечения времени ожидания Ask.

...