Pergunta

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

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.

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

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]

Nenhuma solução correta

Outras dicas

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.

In the logs I found the error

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();

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.

SecuresSocial 2.1.3 and master-SNAPSHOT are supposed to work with Play 2.2.1. I think that what's causing the problem is that your UserService implementation is being compiled for 1.7 but the code that is trying to load it was compiled for 1.6.

By default Scala 2.10 generates bytecode for 1.6. You can generate 1.7 but as far as I understand that feature is experimental. 1.6 is preferred. I'd change the sbt file to generate 1.6 bytecode. That should make it work.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top