_ [2.0] EhCachePlugin error: "Cache play already exists", when deploying a "play dist" build

2,687 views
Skip to first unread message

KajMagnus

unread,
Mar 31, 2012, 4:32:51 PM3/31/12
to play-framework
Hi

I'm getting an "Cache play already exists" in EhCachePlugin when I
deploy my Play 2 app on my production machine.
I deploy by building Play with "play dist" and unzipping the generated
zip file and rsync:ing it to the production server.

I've worked around the problem by disabling the ehcache, in the
application.conf file, like so:
ehcacheplugin=disabled
(( But perhaps soon you'll need to specify:
ehcacheplugin.enabled=false
ehcacheplugin.disabled=true
instead, because there's either a documentation bug or a code bug in
EhCachePlugin. ))

(Perhaps someone else runs into the same problem,
or perhaps the Play 2 devs aren't aware about it yet,
hence this email.)

(I found some old threads related to Play 1 when I searched for "Cache
play already exists", but I got the impression that that issue had
already been fixed. So perhaps that was another issue.)


Here's the error and stack trace:

[ec2-user@dw0azewdbpv11danny debiki.se]$ Play server process ID is
1387
Oops, cannot start the server.
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(LinearSeqOpti...
at scala.collection.immutable.List.foreach(List.scala:45)
at play.api.Play$.start(Play.scala:60)
at play.core.StaticApplication.<init>(ApplicationProvider.scala:
51)
at play.core.server.NettyServer$.createServer(NettyServer.scala:
132)
at play.core.server.NettyServer$$anonfun$main
$5.apply(NettyServer...
at play.core.server.NettyServer$$anonfun$main
$5.apply(NettyServer...
at scala.Option.map(Option.scala:133)
at play.core.server.NettyServer$.main(NettyServer.scala:152)
at play.core.server.NettyServer.main(NettyServer.scala)


Best regards, KajMagnus

KajMagnus

unread,
Mar 31, 2012, 4:35:58 PM3/31/12
to play-framework
( I'm using this Play 2 version:

commit edc0fadf3ff02ed5c562b15f87726a1ea2cd25b2
Date: Wed Mar 28 16:32:42 2012 -0400

/KajMagnus )

peter hausel

unread,
Mar 31, 2012, 4:50:16 PM3/31/12
to play-fr...@googlegroups.com
Hi,

i just tested it using our integration test and it worked for me.

Your error seems to indicate that you may have two EhCachePlugin configured, so please make sure
you do not have a second plugin registered somewhere (ie in your play.plugins).

Thanks,
Peter

KajMagnus

unread,
Apr 2, 2012, 12:15:46 AM4/2/12
to play-framework
Hi Peter

Okay, thanks, and thanks for testing.

With "play.plugins", did you mean a file "conf/play.plugins" ?
I have no such file at all, actually.

(Including directory trees and a plugin.sbt file below.)
(Everything works just fine for me right now since I've disabled the
cache)

Best regards, KajMagnus


$ tree conf/
conf/
├── application.conf
├── prod.conf
└── routes

$ tree -L 2 project/
project/
├── boot
│   ├── other
│   ├── sbt.boot.lock
│   ├── scala-2.8.1
│   └── update.log
├── build.properties
├── Build.scala
├── plugins.sbt
├── project
│   └── target
└── target
├── config-classes
├── scala-2.9.1
└── streams

$ cat project/plugins.sbt
// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/
typesafe/releases/"

// Use Play's SBT plugin version.
addSbtPlugin("play" % "sbt-plugin" % "2.1-SNAPSHOT")

// The SBT-Idea plugin, https://github.com/mpeltonen/sbt-idea
// ---------------------------------------------------------------
resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")

Guillaume Bort

unread,
Apr 2, 2012, 6:47:49 AM4/2/12
to play-fr...@googlegroups.com
Yes there is 2 play.plugins file in your classpath. Check for
duplicate jar entries into the dist zip file. But we should mark this
as a bug. The plugin loader should detect same plugin loaded twice
(and probably output a warning message).

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>

--
Guillaume Bort

KajMagnus

unread,
Apr 5, 2012, 1:47:34 AM4/5/12
to play-framework
Hi Guillaume and Peter

Problem solved, thanks.

@Guillaume: Yes there are duplicate files in my unzipped dist folder.
The reason is probably that I didn't clean that folder,
when I upgraded from a pre-2.0 version (RC3) to a post-2.0 version.

I just commented out "ehcacheplugin=disabled",
rsynced again, with the --delete option.

Now the error doesn't happen any more, although the cache is enabled.

**

I still cannot find any "play.plugins" file in my classpath though.
But there were some duplicated files, e.g. "play.play_" and
"play.templates_" files,
in my unzipped dist folder (before I rsynced with --delete).

(( In case it's useful for you in some manner:
Below follows files with "play" in their name, in the dist/lib folder,
then all files in that folder. (From before I rsynced with --
delete.) ))


Thanks for your help
KajMagnus



$ cd path/to/unzipped-Play-dist-folder--on-production-server/

$ ls -1 lib | sort | grep -i play
debiki-app-play_2.9.1-1.0-SNAPSHOT.jar
play.anorm_2.9.1-2.0-SNAPSHOT.jar
play.anorm_2.9.1-2.1-SNAPSHOT.jar
play.play_2.9.1-2.0-SNAPSHOT.jar <-- oops
play.play_2.9.1-2.1-SNAPSHOT.jar <-- oops
play.templates_2.9.1-2.0-SNAPSHOT.jar
play.templates_2.9.1-2.1-SNAPSHOT.jar

$ ls -1 lib | sort
ch.qos.logback.logback-classic-1.0.0.jar
ch.qos.logback.logback-core-1.0.0.jar
com.amazonaws.aws-java-sdk-1.3.4.jar
com.codahale.jerkson_2.9.1-0.5.0.jar
com.github.jsuereth.scala-arm.scala-arm_2.9.1-0.3.jar
com.github.scala-incubator.io.scala-io-core_2.9.1-0.2.0.jar
com.github.scala-incubator.io.scala-io-file_2.9.1-0.2.0.jar
com.google.code.findbugs.jsr305-1.3.9.jar
com.google.guava.guava-10.0.1.jar
com.h2database.h2-1.3.158.jar
com.jolbox.bonecp-0.7.1.RELEASE.jar
commons-codec.commons-codec-1.5.jar
commons-lang.commons-lang-2.6.jar
commons-logging.commons-logging-1.1.1.jar
com.ning.async-http-client-1.7.0.jar
com.thoughtworks.paranamer.paranamer-2.3.jar
com.typesafe.akka.akka-actor-2.0.jar
com.typesafe.akka.akka-actor-2.0-RC4.jar
com.typesafe.akka.akka-slf4j-2.0.jar
com.typesafe.akka.akka-slf4j-2.0-RC4.jar
debiki-app-play_2.9.1-1.0-SNAPSHOT.jar
debiki-core_2.9.1-0.0.2-SNAPSHOT.jar
debiki-dao-pgsql_2.9.1-0.0.2-SNAPSHOT.jar
debiki-tck-dao_2.9.1-0.0.2-SNAPSHOT.jar
io.netty.netty-3.3.0.Final.jar
javassist.javassist-3.12.1.GA.jar
javax.activation.activation-1.1.jar
javax.mail.mail-1.4.4.jar
javax.servlet.javax.servlet-api-3.0.1.jar
javax.transaction.jta-1.1.jar
javax.validation.validation-api-1.0.0.GA.jar
jaxen.jaxen-1.1.3.jar
joda-time.joda-time-2.0.jar
net.liftweb.lift-actor_2.9.1-2.4-M5.jar
net.liftweb.lift-common_2.9.1-2.4-M5.jar
net.liftweb.lift-json_2.9.1-2.4-M5.jar
net.liftweb.lift-util_2.9.1-2.4-M5.jar
net.sf.ehcache.ehcache-core-2.5.0.jar
nu.validator.htmlparser.htmlparser-1.2.1.jar
oauth.signpost.signpost-core-1.2.1.1.jar
org.apache.httpcomponents.httpclient-4.1.2.jar
org.apache.httpcomponents.httpcore-4.1.2.jar
org.avaje.ebean-2.7.3.jar
org.codehaus.jackson.jackson-core-asl-1.9.5.jar
org.codehaus.jackson.jackson-mapper-asl-1.9.5.jar
org.hibernate.hibernate-validator-4.2.0.Final.jar
org.hibernate.javax.persistence.hibernate-jpa-2.0-api-1.0.1.Final.jar
org.joda.joda-convert-1.1.jar
org.reflections.reflections-0.9.6.jar
org.scala-lang.scala-compiler-2.9.1.jar
org.scala-lang.scala-library-2.9.1.jar
org.scala-lang.scalap-2.9.1.jar
org.scala-tools.scala-stm_2.9.1-0.4.jar
org.slf4j.jcl-over-slf4j-1.6.4.jar
org.slf4j.jul-to-slf4j-1.6.4.jar
org.slf4j.slf4j-api-1.6.4.jar
org.springframework.spring-beans-3.0.7.RELEASE.jar
org.springframework.spring-context-3.0.7.RELEASE.jar
org.springframework.spring-core-3.0.7.RELEASE.jar
org.yaml.snakeyaml-1.9.jar
play.anorm_2.9.1-2.0-SNAPSHOT.jar
play.anorm_2.9.1-2.1-SNAPSHOT.jar
play.play_2.9.1-2.0-SNAPSHOT.jar
play.play_2.9.1-2.1-SNAPSHOT.jar
play.templates_2.9.1-2.0-SNAPSHOT.jar
play.templates_2.9.1-2.1-SNAPSHOT.jar
postgresql-9.1-901.jdbc4.jar
tyrex.tyrex-1.0.1.jar

peter hausel

unread,
Apr 6, 2012, 9:00:34 AM4/6/12
to play-fr...@googlegroups.com
it's in play.play_2.9.1-2.x.jar (plus in your custom jar(s) if you created any with custom play.plugins)

Guy Mahieu

unread,
Apr 27, 2012, 5:15:30 AM4/27/12
to play-framework
In fact the 'idea' command adds the sources the wrong way; they are
added to the iml file as 'classes' rather than 'sources' attached to
certain jars... this means all resources in the source jars will be on
the classpath.
Reply all
Reply to author
Forward
0 new messages