Note that there are some explanatory texts on larger screens.

plurals
  1. POPlayframework standalone jobs connect to database twice
    text
    copied!<p>I have a standalone job in Play 2.0.4 that I want to run on Heroku as described in <a href="https://github.com/jamesward/play2-scheduled-job-demo" rel="nofollow">https://github.com/jamesward/play2-scheduled-job-demo</a> I start the application just like in the samples:</p> <pre><code>public class QueueWorker { public static void main(String[] args) { Application application = new Application(new File(args[0]), QueueWorker.class.getClassLoader(), null, Mode.Dev()); Play.start(application); } } </code></pre> <p>But now, judging from the logs, Play connects to the database <em>twice</em> for some reason and EhCache fails the second time because it the name is already registered:</p> <pre><code>[[37minfo[0m] play - database [default] connected at jdbc:mysql://localhost/myproject?characterEncoding=UTF-8 [[37minfo[0m] play - database [default] connected at jdbc:mysql://localhost/myproject?characterEncoding=UTF-8 Exception in thread "main" net.sf.ehcache.ObjectExistsException: Cache play already exists at net.sf.ehcache.CacheManager.addCache(CacheManager.java:990) at play.api.cache.EhCachePlugin.x$3(Cache.scala:111) at play.api.cache.EhCachePlugin.cache(Cache.scala:109) at play.api.cache.EhCachePlugin.onStart(Cache.scala:127) at play.api.Play$$anonfun$start$1.apply(Play.scala:60) at play.api.Play$$anonfun$start$1.apply(Play.scala:60) at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) at scala.collection.immutable.List.foreach(List.scala:45) at play.api.Play$.start(Play.scala:60) at play.api.Play.start(Play.scala) at jobs.QueueWorker.main(QueueWorker.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) </code></pre> <p>Interestingly this does not happen when I start the project with the "play run" command. Has anybody got a hint for me what this could be, or how I can debug where it's coming from?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload