2012-07-02 108 views
3

我是使用Play Framework的新手,我試圖將SecureSocial插件與Facebook-OAuth2提供程序合併到我的應用程序中。我就遇到了這個錯誤,當我發送一個GET請求來/loginPlay Framework + SecureSocial:java.lang.NoSuchMethodError:securesocial.controllers.ReverseLoginPage.authenticate

! @6apkmf9m3 - Internal server error, for request [GET /login] -> 

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NoSuchMethodError: securesocial.controllers.ReverseLoginPage.authenticate(Ljava/lang/String;)Lplay/api/mvc/Call;]] 
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.2] 
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.2] 
    at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2] 
    at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.2] 
    at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2] 
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2] 
Caused by: java.lang.NoSuchMethodError: securesocial.controllers.ReverseLoginPage.authenticate(Ljava/lang/String;)Lplay/api/mvc/Call; 
    at securesocial.core.IdentityProvider.authenticationUrl(IdentityProvider.scala:86) ~[classes/:na] 
    at securesocial.views.html.login$$anonfun$apply$3$$anonfun$apply$4.apply(login.template.scala:44) ~[classes/:na] 
    at securesocial.views.html.login$$anonfun$apply$3$$anonfun$apply$4.apply(login.template.scala:43) ~[classes/:na] 
    at play.templates.TemplateMagic$.defining(ScalaTemplates.scala:756) ~[templates_2.9.1.jar:2.0.2] 
    at securesocial.views.html.login$$anonfun$apply$3.apply(login.template.scala:43) ~[classes/:na] 
    at securesocial.views.html.login$$anonfun$apply$3.apply(login.template.scala:42) ~[classes/:na] 
  • 可能有人給我上哪兒去找找這個錯誤的詳細信息提示嗎?
  • Play是如何工作的,從securesocial.controllers.ReverseLoginPagesecuresocial.controllers.LoginPage,與前者在模塊中存在?
+0

看起來錯誤在登錄模板中。你能粘貼嗎? – Sietse

+0

是否是securesocial使用的模板? https://github.com/jaliss/securesocial/blob/master/module-code/app/securesocial/views/login.scala.html – Alex

+0

是的,可能。 – Sietse

回答

4

Play 2 documentation

For each controller used in the routes file, the router will generate a ‘reverse controller’ in the routes package, having the same action methods, with the same signature, but returning a play.api.mvc.Call instead of a play.api.mvc.Action.

我想這也正是ReverseLoginPage是從哪裏來的,但我不知道發生了什麼故障。也許在路線上有一些錯誤,或者仍然存在的老班級。嘗試運行clean,只是爲了確保那不是問題。

0

即使我是新玩框架。我現在不知道爲什麼,但這與你的路線文件有關。這是因爲securesocial正試圖調用一個在你的配置中沒有給出路由的動作。嘗試這個示例路線,可能會嘗試通過刪除您認爲不必要的路線來逐個調整路線,以獲得您缺少的一條路線。

# Routes 
# This file defines all application routes (Higher priority routes first) 
# ~~~~ 

# Home page 
GET /       controllers.Application.index() 




# Map static resources from the /public folder to the /assets URL path 
GET  /assets/*file    controllers.Assets.at(path="/public", file) 

# Login page 
GET  /login      securesocial.controllers.LoginPage.login 
GET  /logout      securesocial.controllers.LoginPage.logout 

# User Registration and password handling (only needed if you are using UsernamePasswordProvider) 
GET  /signup      securesocial.controllers.Registration.startSignUp 
POST /signup      securesocial.controllers.Registration.handleStartSignUp 
GET  /signup/:token    securesocial.controllers.Registration.signUp(token) 
POST /signup/:token    securesocial.controllers.Registration.handleSignUp(token) 
GET  /reset      securesocial.controllers.Registration.startResetPassword 
POST /reset      securesocial.controllers.Registration.handleStartResetPassword 
GET  /reset/:token    securesocial.controllers.Registration.resetPassword(token) 
POST /reset/:token    securesocial.controllers.Registration.handleResetPassword(token) 
GET  /password     securesocial.controllers.PasswordChange.page 
POST /password     securesocial.controllers.PasswordChange.handlePasswordChange 


# Providers entry points 
GET  /authenticate/:provider  securesocial.controllers.ProviderController.authenticate(provider) 
POST /authenticate/:provider  securesocial.controllers.ProviderController.authenticateByPost(provider) 
GET  /not-authorized    securesocial.controllers.ProviderController.notAuthorized 

它適用於我玩遊戲2.2.0版本和安全社會是在主人快照。