I created the lagom project and connect to MySQL db with jpa persistence. My configurations files are below. when i run this code table was not created in db, and it displays the error is follow. Please any one help me.
This error diplays after some secons i dont know what i missing in this code.
Error
akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://rdapupdate-impl-application/user/jd
bcCreateTables-singleton/singleton/jdbcCreateTables#-898354221]] after [20000 ms]. Message of type [com.lightbend.lagom.internal.persistence.cluster.ClusterStartupTaskActor$Execute$] was sent by [Actor[akka://rdapupdate-impl-application/user/jdbcCreateTables-singleton/singleton/jdbcCreateTables#-898354221]]. A typical reason for `AskTimeoutException` is that the recipient actor didn't send a reply.
at akka.pattern.PromiseActorRef$.$anonfun$defaultOnTimeout$1(AskSupport.scala:635)
at akka.pattern.PromiseActorRef$.$anonfun$apply$1(AskSupport.scala:650)
at akka.actor.Scheduler$$anon$4.run(Scheduler.scala:205)
at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:870)
at scala.concurrent.BatchingExecutor.execute(BatchingExecutor.scala:109)
at scala.concurrent.BatchingExecutor.execute$(BatchingExecutor.scala:103)
at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:868)
at akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(LightArrayRevolverScheduler.scala:328)
at akka.actor.LightArrayRevolverScheduler$$anon$4.executeBucket$1(LightArrayRevolverScheduler.scala:279)
at akka.actor.LightArrayRevolverScheduler$$anon$4.nextTick(LightArrayRevolverScheduler.scala:283)
at akka.actor.LightArrayRevolverScheduler$$anon$4.run(LightArrayRevolverScheduler.scala:235)
at java.lang.Thread.run(Thread.java:748)
application.conf
#
# Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com>
#
play.modules.enabled += sample.rdapupdate.impl.RdapUpdateServiceModule
rdapupdate.cassandra.keyspace = stream
cassandra-journal.keyspace = ${rdapupdate.cassandra.keyspace}
cassandra-snapshot-store.keyspace = ${rdapupdate.cassandra.keyspace}
lagom.persistence.read-side.cassandra.keyspace =
${rdapupdate.cassandra.keyspace}
akka.cluster.sharding.state-store-mode = ddata
akka.actor.serialization-bindings {
"akka.Done" = akka-misc
"akka.actor.Address" = akka-misc
"akka.remote.UniqueAddress" = akka-misc
}
db.default {
driver = "com.mysql.cj.jdbc.Driver"
url = "jdbc:mysql://localhost:3306/test"
}
lagom.persistence.jdbc.create-tables.auto = true
jdbc-defaults.slick.driver = "slick.driver.MySQLDriver$"
lagom.persistence.jpa {
persistence-unit = "default"
initialization-retry {
interval {
min = 5s
factor = 1.0
}
max-retries = 10
}
}
persistence.xml
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>
<!-- Add any other standard or provider-specific properties -->
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/test" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="root" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
I’m using the following maven dependencies
<dependency>
<groupId>com.lightbend.lagom</groupId>
<artifactId>lagom-javadsl-persistence-jdbc_${scala.binary.version}</artifactId>
<version>${lagom.version}</version>
</dependency>
<dependency>
<groupId>com.lightbend.lagom</groupId>
<artifactId>lagom-javadsl-persistence-jpa_${scala.binary.version}</artifactId>
<version>${lagom.version}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>