Closed adpande closed 11 years ago
Sorry for posting it here. I am not able to find any forum/group links. I am also getting the following error:
[error] application -
! @6cike0o6p - Internal server error, for request [GET /login] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[ExceptionInInitializerError: null]] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4] 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.4] 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.ExceptionInInitializerError: null at securesocial.core.IdentityProvider.authenticationUrl(IdentityProvider.scala:93) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at securesocial.views.html.provider$$anonfun$apply$1$$anonfun$apply$2.apply(provider.template.scala:42) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at securesocial.views.html.provider$$anonfun$apply$1$$anonfun$apply$2.apply(provider.template.scala:41) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at play.templates.TemplateMagic$.defining(ScalaTemplates.scala:756) ~[templates_2.9.1.jar:2.0.4] at securesocial.views.html.provider$$anonfun$apply$1.apply(provider.template.scala:41) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at securesocial.views.html.provider$$anonfun$apply$1.apply(provider.template.scala:39) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] Caused by: java.lang.ClassNotFoundException: securesocial.controllers.ReverseRegistration at java.net.URLClassLoader$1.run(URLClassLoader.java:202) ~[na:1.6.0_37] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_37] at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ~[na:1.6.0_37] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) ~[na:1.6.0_37] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[na:1.6.0_37] at sbt.PlayCommands$$anonfun$61$$anonfun$63$$anon$2$$anonfun$loadClass$1.apply(PlayCommands.scala:563) ~[na:na]
Are you using a custom assets controller?
Nope. I am not using it. I am new to play.
can you share your routes file?
On Mon, Dec 10, 2012 at 11:45 AM, Abhishek Pande notifications@github.comwrote:
Nope. I am not using it. I am new to play.
— Reply to this email directly or view it on GitHubhttps://github.com/jaliss/securesocial/issues/115#issuecomment-11214000.
GET / controllers.Application.index() GET /diffs/:page controllers.DiffController.showPage(page:String)
GET /login securesocial.controllers.LoginPage.login GET /logout securesocial.controllers.LoginPage.logout
GET /authenticate/:provider securesocial.controllers.ProviderController.authenticate(provider) POST /authenticate/:provider securesocial.controllers.ProviderController.authenticateByPost(provider)
GET /assets/*file controllers.Assets.at(path="/public", file)
You commented out the routes for the UsernamePasswordProvider but it looks like you are including it in your play.plugins file. That's why it's failing.
Nope. I do not have UsernamePasswordProvider in play.plugins.
Sent on my BlackBerry® from Vodafone
-----Original Message----- From: Jorge notifications@github.com Date: Mon, 10 Dec 2012 18:00:28 To: jaliss/securesocialsecuresocial@noreply.github.com Reply-To: jaliss/securesocial reply@reply.github.com Cc: Abhishek Pandeadpande@gmail.com Subject: Re: [securesocial] Not able to get this working: java.lang.NoClassDefFoundError: Could not initialize class securesocial.core.providers.utils.RoutesHelper$ (#115)
You commented out the routes for the UsernamePasswordProvider but it looks like you are including it in your play.plugins file. That's why it's failing.
Reply to this email directly or view it on GitHub: https://github.com/jaliss/securesocial/issues/115#issuecomment-11227995
I recently ran into this as well. The GET
ones from the block that says "User Registration and password handling (only needed if you are using UsernamePasswordProvider)" must be uncommented, or that exception will get thrown, even if you aren't using UsernamePasswordProvider
. This took me a good amount of time to figure out. :(
Got it working! Thanks @CodeBlock
This is a bug then.
Will check this out. Thanks @CodeBlock for the work around.
I updated the docs and made those routes required. They won't be used but RoutesHelper needs them there.
I'm trying out the scala sample and getting the same kind of errors.
[securesocial] anonymous user trying to access : '/' ... Internal server error, for request [GET /login] -> play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NoClassDefFoundError: Could not initialize class securesocial.core.providers.utils.RoutesHelper$]] ... Internal server error, for request [GET /signup] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NoClassDefFoundError: Could not initialize class securesocial.core.providers.utils.RoutesHelper$]]
Routes file looks like:
GET / controllers.Application.index GET /only-twitter controllers.Application.onlyTwitter
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /login securesocial.controllers.LoginPage.login GET /logout securesocial.controllers.LoginPage.logout
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
GET /authenticate/:provider securesocial.controllers.ProviderController.authenticate(provider) POST /authenticate/:provider securesocial.controllers.ProviderController.authenticateByPost(provider) GET /not-authorized securesocial.controllers.ProviderController.notAuthorized
assetsController=controllers.ReverseMyCustomAssetsController
... in securesocial.conf isn't commented out by default, easy to miss. Commenting it out fixes my issue.
@derekdon what version are you using? just checked and that property is not there in the securesocial.conf files for master and 2.0.8 in both Java and Scala samples.
@jaliss Yeah I can see that now, I must of copied the basis contents from the http://securesocial.ws/guide/configuration.html and not taken it directly from the scala sample.
Seems to be okay now, but I am having another problem... when I allow the app access via google auth it then drops me back to the login page... console shows the following error.
[error] application - Unable to log user in. An exception was thrown securesocial.core.AuthenticationException: null at securesocial.core.OAuth2Provider.doAuth(OAuth2Provider.scala:114) ~[securesocial_2.9.1-2.0.8.jar:2.0.8] at securesocial.core.IdentityProvider.authenticate(IdentityProvider.scala:73) ~[securesocial_2.9.1-2.0.8.jar:2.0.8] at securesocial.controllers.ProviderController$$anonfun$handleAuth$1.apply(ProviderController.scala:85) [securesocial_2.9.1-2.0.8.jar:2.0.8] at securesocial.controllers.ProviderController$$anonfun$handleAuth$1.apply(ProviderController.scala:81) [securesocial_2.9.1-2.0.8.jar:2.0.8] at play.api.mvc.Action$$anon$1.apply(Action.scala:170) [play_2.9.1-2.0.4.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) [play_2.9.1-2.0.4.jar:2.0.4]
Going to dig into this later, but for now do you have any ideas what's wrong?
Also seeing this when I start up the app and try to access /
Play server process ID is 4414 [info] application - [securesocial] loaded templates plugin: securesocial.controllers.DefaultTemplatesPlugin [info] play - Starting application default Akka system. [info] application - [securesocial] loaded user service: class service.InMemoryUserService [info] application - [securesocial] loaded password hasher bcrypt [info] application - Application has started [debug] application - [securesocial] calling deleteExpiredTokens() 2013-01-11 09:13:19.983 INFO com.couchbase.client.CouchbaseConnection: Added {QA sa=/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2013-01-11 09:13:19.988 INFO com.couchbase.client.CouchbaseConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@19f9d2 2013-01-11 09:13:19.988 INFO com.couchbase.client.CouchbaseClient: viewmode set to development mode 2013-01-11 09:13:20.058 INFO net.spy.memcached.auth.AuthThread: Authenticated to localhost.localdomain/127.0.0.1:11210 2013-01-11 09:13:20.068 INFO com.couchbase.client.ViewConnection: Added localhost.localdomain/127.0.0.1:8092 to connect queue [info] application - [securesocial] loaded identity provider: twitter [info] application - [securesocial] loaded identity provider: google [info] application - [securesocial] loaded identity provider: userpass [info] play - Application started (Prod) [info] play - Listening for HTTP on port 9000... [error] application -
! @6d1hj5png - Internal server error, for request [GET /] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added]] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1-2.0.4.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1-2.0.4.jar:2.0.4] at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor-2.0.2.jar:2.0.2] at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1-2.0.4.jar:2.0.4] at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor-2.0.2.jar:2.0.2] at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor-2.0.2.jar:2.0.2] Caused by: java.lang.IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added at org.jboss.netty.handler.codec.http.CookieEncoder.encodeServerSide(CookieEncoder.java:101) ~[netty-3.5.5.Final.jar:na] at org.jboss.netty.handler.codec.http.CookieEncoder.encode(CookieEncoder.java:91) ~[netty-3.5.5.Final.jar:na] at play.api.mvc.Cookies$.encode(Http.scala:574) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.Cookies$.merge(Http.scala:598) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.PlainResult$class.withCookies(Results.scala:84) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.SimpleResult.withCookies(Results.scala:192) ~[play_2.9.1-2.0.4.jar:2.0.4]
@derekdon do you see the error if you run the app in dev mode?
@jaliss If I run it on my VPS via sbt run (dev mode?), I still see the following when I access /
Execution exception
[IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added]
... accessing the /login page works fine, as does clicking google to authenticate, allowing access, but again I am throw back to the login page with the following:
[debug] application - [securesocial] authorizationUrl = https://accounts.google.com/o/oauth2/auth [debug] application - [securesocial] redirecting to: [https://accounts.google.com/o/oauth2/auth?scope=..[removed for github post] [debug] application - [securesocial] user = None [error] application - Unable to log user in. An exception was thrown securesocial.core.AuthenticationException: null at securesocial.core.OAuth2Provider.doAuth(OAuth2Provider.scala:114) ~[securesocial_2.9.1-2.0.8.jar:2.0.8] at securesocial.core.IdentityProvider.authenticate(IdentityProvider.scala:73) ~[securesocial_2.9.1-2.0.8.jar:2.0.8] at securesocial.controllers.ProviderController$$anonfun$handleAuth$1.apply(ProviderController.scala:85) [securesocial_2.9.1-2.0.8.jar:2.0.8] at securesocial.controllers.ProviderController$$anonfun$handleAuth$1.apply(ProviderController.scala:81) [securesocial_2.9.1-2.0.8.jar:2.0.8] at play.api.mvc.Action$$anon$1.apply(Action.scala:170) [play_2.9.1-2.0.4.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) [play_2.9.1-2.0.4.jar:2.0.4]
Using: "securesocial" % "securesocial_2.9.1" % "2.0.8", ... resolvers += Resolver.url("SecureSocial Repository", url("http://securesocial.ws/repository/releases/"))(Resolver.ivyStylePatterns),
@jaliss Might be something to do with the InMemoryUserService in production, but it doesn't seem to be working in dev mode either.
@derekdon I don't think that's releted. It's complaining about encoding 2 cookies. Can you try running from the play console? the error says you are running in prod mode
@jaliss Sorry about this, maybe leave it with my and I can try to figure it out... Results below on local machine, same issue.
D:\dev\code\test\mm\mm.play>play [info] Loading project definition from D:\dev\code\test\mm\mm.play\project [info] Set current project to mm.play (in build file:/D:/dev/code/test/mm/mm.play/) | | | | | ' | |/ ' | || || | **/||**| () || |__/
play! 2.0.3, http://www.playframework.org
Type "help play" or "license" for more information. Type "exit" or use Ctrl+D to leave this console.
[mm.play] $ run
[info] Updating {file:/D:/dev/code/test/mm/mm.play/}mm.play... [info] Done updating. --- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on port 9000...
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 9 Scala sources and 1 Java source to D:\dev\code\test\mm\mm.play\target\scala-2.9.1\classes... [info] application - [securesocial] loaded templates plugin: securesocial.controllers.DefaultTemplatesPlugin [info] play - Starting application default Akka system. [info] application - [securesocial] loaded user service: class service.InMemoryUserService [info] application - [securesocial] loaded password hasher bcrypt [info] application - [securesocial] loaded identity provider: twitter [info] application - Application has started [debug] application - [securesocial] calling deleteExpiredTokens() 2013-01-11 14:30:08.778 INFO com.couchbase.client.CouchbaseConnection: Added {QA sa=/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2013-01-11 14:30:08.792 INFO com.couchbase.client.CouchbaseClient: viewmode set to development mode 2013-01-11 14:30:08.792 INFO com.couchbase.client.CouchbaseConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@1bda30a 2013-01-11 14:30:08.912 INFO net.spy.memcached.auth.AuthThread: Authenticated to 127.0.0.1/127.0.0.1:11210 2013-01-11 14:30:08.916 INFO com.couchbase.client.ViewConnection: Added 127.0.0.1/127.0.0.1:8092 to connect queue [info] application - [securesocial] loaded identity provider: google [info] application - [securesocial] loaded identity provider: userpass [info] play - Application started (Dev) [debug] application - [securesocial] anonymous user trying to access : '/' [debug] application - [securesocial] assets controller = controllers.ReverseAssets [error] application -
! @6d1j8i4bj - Internal server error, for request [GET /] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added]] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1-2.0.4.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1-2.0.4.jar:2.0.4] 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-2.0.4.jar:2.0.4] 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.IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added at org.jboss.netty.handler.codec.http.CookieEncoder.encodeServerSide(CookieEncoder.java:101) ~[netty-3.5.5.Final.jar:na] at org.jboss.netty.handler.codec.http.CookieEncoder.encode(CookieEncoder.java:91) ~[netty-3.5.5.Final.jar:na] at play.api.mvc.Cookies$.encode(Http.scala:574) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.Cookies$.merge(Http.scala:598) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.PlainResult$class.withCookies(Results.scala:84) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.SimpleResult.withCookies(Results.scala:192) ~[play_2.9.1-2.0.4.jar:2.0.4]
you are using play 2.0.3 .. can you try 2.0.4?
@jaliss Sure, give me a few minutes... Thanks for your help
@jaliss Not sure why I'm seeing "Update the Play sbt-plugin version to 2.0.3 (usually in project/plugins.sbt)" when it is now set to 2.0.4? You can see the jars are play_2.9.1-2.0.4.jar
Anyway the output is the same...
D:\dev\code\test\mm\mm.play>play [info] Loading project definition from D:\dev\code\test\mm\mm.play\project
This project uses Play 2.0.4! Update the Play sbt-plugin version to 2.0.3 (usually in project/plugins.sbt)
[info] Set current project to mm.play (in build file:/D:/dev/code/test/mm/mm.play/) | | | | | ' | |/ ' | || || | **/||**| () || |__/
play! 2.0.4, http://www.playframework.org
Type "help play" or "license" for more information. Type "exit" or use Ctrl+D to leave this console.
[mm.play] $ run
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on port 9000...
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 9 Scala sources and 3 Java sources to D:\dev\code\test\mm\mm.play\target\scala-2.9.1\classes... [info] application - [securesocial] loaded templates plugin: securesocial.controllers.DefaultTemplatesPlugin [info] play - Starting application default Akka system. [info] application - [securesocial] loaded user service: class service.InMemoryUserService [info] application - [securesocial] loaded password hasher bcrypt [info] application - [securesocial] loaded identity provider: twitter [info] application - Application has started [debug] application - [securesocial] calling deleteExpiredTokens() 2013-01-11 15:15:51.622 INFO com.couchbase.client.CouchbaseConnection: Added {QA sa=/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2013-01-11 15:15:51.642 INFO com.couchbase.client.CouchbaseConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@116639 2013-01-11 15:15:51.643 INFO com.couchbase.client.CouchbaseClient: viewmode set to development mode 2013-01-11 15:15:51.729 INFO net.spy.memcached.auth.AuthThread: Authenticated to 127.0.0.1/127.0.0.1:11210 2013-01-11 15:15:51.738 INFO com.couchbase.client.ViewConnection: Added 127.0.0.1/127.0.0.1:8092 to connect queue [info] application - [securesocial] loaded identity provider: google [info] application - [securesocial] loaded identity provider: userpass [info] play - Application started (Dev) [debug] application - [securesocial] anonymous user trying to access : '/' [debug] application - [securesocial] assets controller = controllers.ReverseAssets [error] application -
! @6d1jejk6e - Internal server error, for request [GET /] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added]] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1-2.0.4.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1-2.0.4.jar:2.0.4] 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-2.0.4.jar:2.0.4] 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.IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added at org.jboss.netty.handler.codec.http.CookieEncoder.encodeServerSide(CookieEncoder.java:101) ~[netty-3.5.5.Final.jar:na] at org.jboss.netty.handler.codec.http.CookieEncoder.encode(CookieEncoder.java:91) ~[netty-3.5.5.Final.jar:na] at play.api.mvc.Cookies$.encode(Http.scala:574) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.Cookies$.merge(Http.scala:598) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.PlainResult$class.withCookies(Results.scala:84) ~[play_2.9.1-2.0.4.jar:2.0.4] at play.api.mvc.SimpleResult.withCookies(Results.scala:192) ~[play_2.9.1-2.0.4.jar:2.0.4]
Just switched from 2.0.8 to using;
"securesocial" % "securesocial_2.9.1" % "master", ... and resolvers += Resolver.url("SecureSocial Repository", url("http://securesocial.ws/repository/snapshots/"))(Resolver.ivyStylePatterns),
but it's still an issue unfortunately.
[IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added]
@jaliss Right I just updated the VPS to use Play 2.0.4 and tried it again on the server in dev mode, same results I'm afraid. What the hell am I doing wrong? Driving me nuts.
[mm.play] $ root@buildserver1:/usr/share/jenkins/jobs/mm.play/workspace# play [info] Loading project definition from /usr/share/jenkins/jobs/mm.play/workspace/project [info] Set current project to mm.play (in build file:/usr/share/jenkins/jobs/mm.play/workspace/) | | | | | ' | |/ ' | || || | **/||**| () || |__/
play! 2.0.4, http://www.playframework.org
Type "help play" or "license" for more information. Type "exit" or use Ctrl+D to leave this console.
[mm.play] $ run
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on port 9000...
(Server started, use Ctrl+D to stop and go back to the console...)
[info] application - [securesocial] loaded templates plugin: securesocial.controllers.DefaultTemplatesPlugin [info] play - Starting application default Akka system. [info] application - [securesocial] loaded user service: class service.InMemoryUserService [info] application - [securesocial] loaded password hasher bcrypt [info] application - [securesocial] loaded identity provider: twitter [info] application - Application has started [debug] application - [securesocial] calling deleteExpiredTokens() 2013-01-11 15:53:19.468 INFO com.couchbase.client.CouchbaseConnection: Added {QA sa=/127.0.0.1:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2013-01-11 15:53:19.473 INFO com.couchbase.client.CouchbaseConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@65724d 2013-01-11 15:53:19.474 INFO com.couchbase.client.CouchbaseClient: viewmode set to development mode 2013-01-11 15:53:19.785 INFO net.spy.memcached.auth.AuthThread: Authenticated to localhost.localdomain/127.0.0.1:11210 2013-01-11 15:53:19.812 INFO com.couchbase.client.ViewConnection: Added localhost.localdomain/127.0.0.1:8092 to connect queue [info] application - [securesocial] loaded identity provider: google [info] application - [securesocial] loaded identity provider: userpass [info] play - Application started (Dev) [debug] application - [securesocial] anonymous user trying to access : '/' [debug] application - [securesocial] assets controller = controllers.ReverseAssets [error] application -
! @6d1jjici7 - Internal server error, for request [GET /] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added]] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4] 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.4] 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.IllegalStateException: encode() can encode only one cookie on server mode: 2 cookies added at org.jboss.netty.handler.codec.http.CookieEncoder.encodeServerSide(CookieEncoder.java:101) ~[netty-3.5.5.Final.jar:na] at org.jboss.netty.handler.codec.http.CookieEncoder.encode(CookieEncoder.java:91) ~[netty-3.5.5.Final.jar:na] at play.api.mvc.Cookies$.encode(Http.scala:574) ~[play_2.9.1.jar:2.0.4] at play.api.mvc.Cookies$.merge(Http.scala:598) ~[play_2.9.1.jar:2.0.4] at play.api.mvc.PlainResult$class.withCookies(Results.scala:84) ~[play_2.9.1.jar:2.0.4] at play.api.mvc.SimpleResult.withCookies(Results.scala:192) ~[play_2.9.1.jar:2.0.4] [info] play - Shutdown application default Akka system. [debug] application - [securesocial] calling deleteExpiredTokens() [info] application - [securesocial] unloaded password hasher bcrypt [info] application - [securesocial] unloaded identity provider: twitter [info] application - Application shutdown... 2013-01-11 15:53:23.215 INFO com.couchbase.client.CouchbaseConnection: Shut down Couchbase client 2013-01-11 15:53:23.223 WARN com.couchbase.client.ViewConnection: Shutting down with ops waiting to be written 2013-01-11 15:53:23.224 INFO com.couchbase.client.ViewNode: [info] application - [securesocial] unloaded identity provider: google Couchbase I/O reactor terminated [info] application - [securesocial] unloaded identity provider: userpass
@jaliss Interesting, I downloaded the scala demo as is (didn't change a thing), and ran it locally using $play run, and accessing http://localhost:9000 redirects me to /login as expected without error! Cool! Right just need to figure out the difference. Thanks.
C:\Users\derekdon\Downloads\securesocial-master\samples\scala\demo>play [info] Loading project definition from C:\Users\derekdon\Downloads\securesocial-master\samples\scala\demo\project [info] Set current project to ssdemo-scala (in build file:/C:/Users/derekdon/Downloads/securesocial-master/samples/scala/demo/) | | | | | ' | |/ ' | || || | **/||**| () || |__/
play! 2.0.4, http://www.playframework.org
Type "help play" or "license" for more information. Type "exit" or use Ctrl+D to leave this console.
[ssdemo-scala] $ run
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on port 9000...
(Server started, use Ctrl+D to stop and go back to the console...)
[info] application - [securesocial] loaded templates plugin: securesocial.controllers.DefaultTemplatesPlugin [info] play - Starting application default Akka system. [info] application - [securesocial] loaded user service: class service.InMemoryUserService [info] application - [securesocial] loaded password hasher bcrypt [info] application - [securesocial] loaded identity provider: twitter [info] application - [securesocial] loaded identity provider: facebook [info] application - [securesocial] loaded identity provider: google [info] application - [securesocial] loaded identity provider: linkedin [info] application - [securesocial] loaded identity provider: userpass [info] application - [securesocial] loaded identity provider: github [info] play - Application started (Dev) [debug] application - [securesocial] calling deleteExpiredTokens() [debug] application - [securesocial] anonymous user trying to access : '/' [debug] application - [securesocial] assets controller = controllers.ReverseAssets
@jaliss Okay I have finally found want is causing this in my case... Not sure why, but if I remove couchbase from my appDependencies it works.
val appDependencies = Seq( "couchbase" % "couchbase-client" % "1.1-dp3",
Even with any couchbase datasource implementation removed, it still wouldn't work until I removed this dependencies in my Build.scala file. Strange... Any idea why that causes it?
Thanks for your help, great to be getting to the bottom of this. Securesocial now looks like a really nice play module that it's working... Just need to figure out how to keep couchbase and securesocial happy together.
@derekdon weird, good to know you found the problem. did you update your plugins.sbt file to use 2.0.4 instead of 2.0.3?
@jaliss Yeah I updated the plugins.sbt to 2.0.4. It's strange as both work fine independently in the project, I'm using couchbase in this and other projects without issue. But when both couchbase and securesocial dependencies are defined these errors occur. Reading the error it would seem that perhaps both are adding a cookie of some sort and that only one is allowed... Might try it with the play-oauth-client module and see if that works together with couchbase. It really annoying as I really wanted to use securesocial. I'll keep investigating, but if you want to see it for yourself just add a couchbase dependency to the sample project and that should do it. Cheers.
@jaliss Am I right in thinking that line 136 of SecureSocial.scala is adding to an existing cookie?
Redirect(RoutesHelper.login()).flashing("error" -> Messages("securesocial.loginRequired")).withSession( session + (SecureSocial.OriginalUrlKey -> request.uri) )
yes. That line updates the Play session cookie.
I'm getting the same error, but i don't have a couchbase dependency, I need to get to the bottom of it though because I've already had some Securesocial and JClouds classpath issues, so I suspect sadly its related.
Looks like something is bringing in a newer version of Netty which has a new feature: if (cookies.size() > 1) { throw new IllegalStateException( "encode() can encode only one cookie on server mode: " + cookies.size() + " cookies added"); }
But the cookie list has a PLAY_FLASH cookie with a thank you comment, and also there is an additional PLAY_SESSION cookie now.
I guess its not securesocial's fault, but i'm not sure how i can go about fixing it, SBT doesn't seem to be able to force older versions of transative dependencies
I am using the java sample provided with securesocial,play 2.0.4, sbt 0.11.3. My target is to edit the custom login page provided by securesocial and as such I have created a new plugin and registered it in play.plugins as securesocial.controllers.Securesviewsplugin. I am using securesocial from https://github.com/dr3s/securesocial As instructed there I have also copied the contents of module-core into my project at project/modules/securesocial. At run time I get the exception that - imported `TemplatesPlugin' is permanently hidden by definition of trait TemplatesPlugin in package controllers How do I clear it
Hi,
I am using play 2.0.4 Java with SS 2.0.7.
I am getting this error when hitting the /login url.
[error] application -
! @6cik8gn4n - Internal server error, for request [GET /login] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NoClassDefFoundError: Could not initialize class securesocial.core.providers.utils.RoutesHelper$]] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.4] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4] 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.4] 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.NoClassDefFoundError: Could not initialize class securesocial.core.providers.utils.RoutesHelper$ at securesocial.core.IdentityProvider.authenticationUrl(IdentityProvider.scala:93) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at securesocial.views.html.provider$$anonfun$apply$1$$anonfun$apply$2.apply(provider.template.scala:42) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at securesocial.views.html.provider$$anonfun$apply$1$$anonfun$apply$2.apply(provider.template.scala:41) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at play.templates.TemplateMagic$.defining(ScalaTemplates.scala:756) ~[templates_2.9.1.jar:2.0.4] at securesocial.views.html.provider$$anonfun$apply$1.apply(provider.template.scala:41) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] at securesocial.views.html.provider$$anonfun$apply$1.apply(provider.template.scala:39) ~[securesocial_2.9.1-2.0.7.jar:2.0.7] [debug] application - Calling deleteExpiredTokens() [debug] application - Calling deleteExpiredTokens() [debug] application - Calling deleteExpiredTokens()