我目前正在开发一个WebApp,以便通过Scala提高我在Play Framework中的技能。
我已按照本教程:http://pedrorijo.com/blog/play-slick/
我已经将代码改编为我的用户对象(更改字段),但是全局这与最终结果(https://github.com/nemoo/play-slick3-example)相同,我也通过克隆repo来重现它。唯一能做的就是不同的是我正在使用RDS数据库来测试我的代码。
当我启动没有1.sql的索引页面时,它不起作用,这是正常的,并且它向我显示错误,告诉表用户丢失
当我手动添加续集pro数据库中的表时,一切正常
然而,当我尝试通过play-evolution创建它时,我收到了这个错误:
java.sql.SQLTimeoutException: Timeout after 1004ms of waiting for a connection.
com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:227)
com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:182)
com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:93)
slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:12)
play.api.db.slick.evolutions.internal.DBApiAdapter$DatabaseAdapter.getConnection(DBApiAdapter.scala:57)
play.api.db.slick.evolutions.internal.DBApiAdapter$DatabaseAdapter.getConnection(DBApiAdapter.scala:60)
play.api.db.evolutions.DatabaseEvolutions.databaseEvolutions(EvolutionsApi.scala:124)
play.api.db.evolutions.DatabaseEvolutions.scripts(EvolutionsApi.scala:102)
play.api.db.evolutions.DatabaseEvolutions.scripts(EvolutionsApi.scala:117)
play.api.db.evolutions.DefaultEvolutionsApi.scripts(EvolutionsApi.scala:82)
play.api.db.evolutions.ApplicationEvolutions$$anonfun$play$api$db$evolutions$ApplicationEvolutions$$runEvolutions$1.apply$mcV$sp(ApplicationEvolutions.scala:53)
play.api.db.evolutions.ApplicationEvolutions.withLock(ApplicationEvolutions.scala:99)
play.api.db.evolutions.ApplicationEvolutions.play$api$db$evolutions$ApplicationEvolutions$$runEvolutions(ApplicationEvolutions.scala:49)
play.api.db.evolutions.ApplicationEvolutions$$anonfun$start$1.apply(ApplicationEvolutions.scala:42)
play.api.db.evolutions.ApplicationEvolutions$$anonfun$start$1.apply(ApplicationEvolutions.scala:42)
scala.collection.immutable.Stream.foreach(Stream.scala:594)
play.api.db.evolutions.ApplicationEvolutions.start(ApplicationEvolutions.scala:42)
play.api.db.evolutions.ApplicationEvolutions.<init>(ApplicationEvolutions.scala:150)
play.api.db.evolutions.ApplicationEvolutionsProvider.get$lzycompute(EvolutionsModule.scala:53)
play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:53)
play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:44)
com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
com.google.inject.Guice.createInjector(Guice.java:96)
com.google.inject.Guice.createInjector(Guice.java:84)
play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
play.utils.Threads$.withContextClassLoader(Threads.scala:21)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:164)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131)
scala.Option.map(Option.scala:146)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129)
scala.util.Success.flatMap(Try.scala:231)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:129)
play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:121)
scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
我不知道为什么我在手动完成所有工作正常时都会超时。感谢所有帮助我的人!
答案 0 :(得分:0)
这只是Amazon RDS实例的安全组问题,打开3306端口解决了问题:)