从play framework 2.0.8迁移到2.1.0错误:缓存已存在

时间:2015-02-03 12:02:37

标签: java playframework playframework-2.0 ehcache playframework-2.1

我已经从play framework 2.0.8迁移到了2.1.0,并且每件事情看起来都很完美,但我收到了以下错误:

  

play.api.UnexpectedException:意外异常[ObjectExistsException:缓存已存在]       at play.core.ReloadableApplication $$ anonfun $ get $ 1 $$ anonfun $ 1.apply(ApplicationProvider.scala:142)〜[play_2.10.jar:2.1.0]       at play.core.ReloadableApplication $$ anonfun $ get $ 1 $$ anonfun $ 1.apply(ApplicationProvider.scala:106)〜[play_2.10.jar:2.1.0]       在scala.Option.map(Option.scala:145)〜[scala-library.jar:na]       at play.core.ReloadableApplication $$ anonfun $ get $ 1.apply(ApplicationProvider.scala:106)〜[play_2.10.jar:2.1.0]       at play.core.ReloadableApplication $$ anonfun $ get $ 1.apply(ApplicationProvider.scala:104)〜[play_2.10.jar:2.1.0]       在scala.util.Either $ RightProjection.flatMap(Either.scala:523)[scala-library.jar:na]   引起:net.sf.ehcache.ObjectExistsException:缓存播放已存在       在net.sf.ehcache.CacheManager.addCache(CacheManager.java:1163)〜[ehcache-core.jar:na]       at play.api.cache.EhCachePlugin.x $ 1 $ lzycompute(Cache.scala:122)〜[play_2.10.jar:2.1.0]       at play.api.cache.EhCachePlugin.x $ 1(Cache.scala:120)〜[play_2.10.jar:2.1.0]       at play.api.cache.EhCachePlugin.cache $ lzycompute(Cache.scala:120)〜[play_2.10.jar:2.1.0]       at play.api.cache.EhCachePlugin.cache(Cache.scala:120)〜[play_2.10.jar:2.1.0]       at play.api.cache.EhCachePlugin.onStart(Cache.scala:138)〜[play_2.10.jar:2.1.0]

解决这个问题的方法是什么?

谢谢!

EDITED 这是我的build.scala

import sbt._
import Keys._
import play.Project._
import com.github.play2war.plugin._

object ApplicationBuild extends Build {

val appName         = "Lndlabproject"
val appVersion      = "1.0-SNAPSHOT"

val appDependencies = Seq(
  javaCore, javaJdbc, javaJpa,
  "mysql" % "mysql-connector-java" % "5.1.18",
  "org.hibernate" % "hibernate-entitymanager" % "4.1.3.Final",
  "org.apache.httpcomponents" % "httpclient"  % "4.0.3",
  "japid42" % "japid42_2.9.1" % "0.5.3",
  "org.apache.poi" % "poi" % "3.8",
  "org.apache.poi" % "poi-ooxml" % "3.9",
  "com.feth" %% "play-easymail" % "0.1-SNAPSHOT",
  "org.apache.directory.studio" % "org.apache.commons.io" % "2.4",
  "org.apache.ant" % "ant-jsch" % "1.7.1",
  "play" % "spring_2.9.1" % "2.0" exclude("play","play_2.9.1")
)

 val main = play.Project(appName, appVersion, appDependencies).settings(

    Play2WarPlugin.play2WarSettings: _*)
    .settings(Play2WarKeys.servletVersion := "2.5")
    .settings(

  // Add your own project settings here      
  ebeanEnabled := false, 
  resolvers += Resolver.url("My GitHub Play Repository",   url("http://branaway.github.com/releases/"))(Resolver.ivyStylePatterns),

  resolvers += Resolver.url("play-easymail (release)", url("http://joscha.github.com/play-easymail/repo/releases/"))   (    Resolver.ivyStylePatterns),
  resolvers += Resolver.url("play-easymail (snapshot)", url("http://joscha.github.com/play-easymail/repo/snapshots/"))(Resolver.ivyStylePatterns)
)

 }

修改

这是play dependencies命令的结果

  

+ ---------------------------------------------- ------------------------------- + ------------------ ---------------------------------------------- + --- ------------------------------------------------- +   | net.sf.ehcache:ehcache-core:2.6.0 | play:play_2.10:2.1.0 |作为ehcache-core.jar |   | | play:play_2.9.1:2.0.4 | |   + ------------------------------------------------- ---------------------------- + --------------------- ------------------------------------------- + ------ ---------------------------------------------- +

如何排除它?

1 个答案:

答案 0 :(得分:1)

日志说你有2个缓存插件

通过play dependencies

检查重复的依赖关系

通过执行

排除重复的依赖项

("play" % "play_2.10" % "2.1.1") .exclude("oauth.signpost", "signpost-core")

build.scala 中,其中(派生自).exclude(重复依赖项之一)。