升级到Play Framework 2.2 Securesocial问题 [英] Upgrade to Play Framework 2.2 Securesocial problems

查看:84
本文介绍了升级到Play Framework 2.2 Securesocial问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试升级到Play 2.2,但在获取安全社交功能时遇到了一些问题.

Hi I am trying to upgrade to Play 2.2 and am having some problems getting securesocial to work.

我正在使用论坛中建议的最新快照,但出现以下错误.验证错误表示二进制文件和我使用的版本之间的某个地方已编译的源不兼容.我试过在Java 1.6和1.7之间切换,但遇到相同的问题. 我知道securesocial仅适用于Play 2.1,但是有一些使用securesocial快照的Play 2.2的示例. 也许我应该再次降级.

I am using the latest snapshot as was suggested in the forums but get the error below. The verify error indicates compiled source incompatibility somewhere between binaries and the version I am using. I have tried switching between java 1.6 and 1.7 but get the same issue. I know securesocial is only ready for Play 2.1 but there are examples of Play 2.2 using securesocial snapshot. Perhaps I should just downgrade again.

我的Build.scala

My Build.scala

object ApplicationBuild extends Build {

  val appName = "rm-play"
  val appVersion = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    // Add your project dependencies here,
    javaCore,
    javaJdbc,
    javaEbean,
    "com.google.guava" % "guava" % "15.0",
    "org.codehaus.jackson" % "jackson-core-asl" % "1.9.13",
    "com.dbdeploy" % "maven-dbdeploy-plugin" % "3.0M3",
    "postgresql" % "postgresql" % "9.1-901.jdbc4",
    "joda-time" % "joda-time" % "2.3",
    "com.github.mumoshu" % "play2-memcached_2.10" % "0.3.0.3",
    "net.spy" % "spymemcached" % "2.9.1",
    "com.amazonaws" % "aws-java-sdk"% "1.6.11",
    "ws.securesocial" %% "securesocial" % "master-SNAPSHOT"
  )


  val main = play.Project(appName, appVersion, appDependencies).settings(
    resolvers += Resolver.sonatypeRepo("snapshots"),
    javacOptions in Compile ++= Seq("-source", "1.7", "-target", "1.7")
  )

} 

plugin.sbt

plugin.sbt

logLevel := Level.Warn

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

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % System.getProperty("play.version")

           _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.2-RC2 built with Scala 2.10.3 (running Java 1.7.0_04), http://www.playframework.com

> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.

[rm-play] $ run
[info] Updating {file:/Users/zola/Development/play/receipt-manager/rm-play/}rm-play...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
[info] play - Listening for HTTPS on port /0:0:0:0:0:0:0:0:9443

(Server started, use Ctrl+D to stop and go back to the console...)

[warn] play - Using generated key with self signed certificate for HTTPS. This should not be used in production.
[info] Compiling 12 Scala sources and 19 Java sources to /Users/zola/Development/play/receipt-manager/rm-play/target/scala-2.10/classes...
[info] Compiling 8 Scala sources to /Users/zola/Development/play/receipt-manager/rm-play/target/scala-2.10/classes...
[error] application - 

! @6h5hbne72 - Internal server error, for (GET) [/login] ->

play.api.PlayException: Cannot load plugin[Plugin [service.PersistantUserService] cannot been instantiated.]
    at play.api.WithDefaultPlugins$$anonfun$plugins$1$$anonfun$apply$9.apply(Application.scala:159) ~[play_2.10.jar:2.2.2-RC2]
    at play.api.WithDefaultPlugins$$anonfun$plugins$1$$anonfun$apply$9.apply(Application.scala:128) ~[play_2.10.jar:2.2.2-RC2]
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
    at scala.collection.immutable.List.foreach(List.scala:318) ~[scala-library.jar:na]
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) ~[scala-library.jar:na]
Caused by: java.lang.VerifyError: Stack map does not match the one at exception handler 188 in method service.PersistantUserService.doSave(Lsecuresocial/core/java/Token;)V at offset 116
    at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.7.0_04]
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) ~[na:1.7.0_04]
    at java.lang.Class.getConstructor0(Class.java:2714) ~[na:1.7.0_04]
    at java.lang.Class.getConstructor(Class.java:1674) ~[na:1.7.0_04]
    at play.api.WithDefaultPlugins$$anonfun$plugins$1$$anonfun$apply$9.apply(Application.scala:130) ~[play_2.10.jar:2.2.2-RC2]
    at play.api.WithDefaultPlugins$$anonfun$plugins$1$$anonfun$apply$9.apply(Application.scala:128) ~[play_2.10.jar:2.2.2-RC2]

推荐答案

因此,事实证明,这不仅是编译版本的差异,而且是无害的.

So it turns out it was a lot more innocuous than just a difference in compile versions.

引起错误的是下面的行,将其更改为使用方法而不是通过字段纠正了问题.

What was causing the error was the line below, changing it to using the method rather than the field corrected the problem.

在日志中我发现了错误

原因: 类型"securesocial/core/java/Token"(当前框架,本地[4])不能分配给"model/LocalToken"(堆栈图,本地[4])

Reason: Type 'securesocial/core/java/Token' (current frame, locals[4]) is not assignable to 'model/LocalToken' (stack map, locals[4])

localToken.uuid = token.uuid;

更改为以下内容可以解决该问题.

changed to below resolved the issue.

localToken.uuid = token.getUuid();

我不确定为什么这对我没有太多scala经验的人有所帮助,但是现场调用会生成该方法,也许是造成问题的原因.

I am not exactly sure why this helped I don't have all that much experience with scala but the field call generates the method and perhaps it was this causing the problem.

这篇关于升级到Play Framework 2.2 Securesocial问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆