securesocial, resources not found

547 views
Skip to first unread message

Borut

unread,
Jul 1, 2014, 3:46:57 PM7/1/14
to secure...@googlegroups.com

I'm using latest master branch of SecureSocial and Play Framework 2.3.1.
Everything works well except loading of resources (javascript, css, images).

Any clue how to fix this issue?

[debug] application - Unforseen error for bootstrap/css/bootstrap.min.css at /public/securesocial
java.lang.RuntimeException: no resource
    at controllers.Assets$$anonfun$controllers$Assets$$assetInfoFromResource$1$$anonfun$13.apply(Assets.scala:237) ~[play_2.11-2.3.1.jar:2.3.1]
    at controllers.Assets$$anonfun$controllers$Assets$$assetInfoFromResource$1$$anonfun$13.apply(Assets.scala:237) ~[play_2.11-2.3.1.jar:2.3.1]
    at scala.Option.getOrElse(Option.scala:120) ~[scala-library-2.11.1.jar:na]

Keyur Raval

unread,
Jul 3, 2014, 4:03:41 AM7/3/14
to secure...@googlegroups.com
Hi Borut,

There seems to be some issue with path. Make a folder "securesocial" under public. Put your bootstrap, javascript and image files under this folder. I have tried this and it works. I am not sure if it is right.

Jorge Aliss

unread,
Jul 3, 2014, 1:53:35 PM7/3/14
to secure...@googlegroups.com
SecureSocial looks for its assets inside public/securesocial.  Borut, I think you are not using the securesocial.Routes file but rather added the routes yourself?

Borut

unread,
Jul 3, 2014, 3:29:57 PM7/3/14
to secure...@googlegroups.com

Jorge, yes, I added this line into  routes file:  "->          /auth                securesocial.Routes"

Keyur, if I add bootstrap and other content to my public folder manually, it works ok. But I guess this would be just a temporary solution.


Jorge Aliss

unread,
Jul 4, 2014, 12:26:13 PM7/4/14
to secure...@googlegroups.com
As I said, SecureSocial looks for its resources in public/securesocial.  See the routes file:

GET         /assets/*file        securesocial.controllers.Assets.at(path = "/public/securesocial", file)

If you don't want that, then don't include the default securesocial.Routes and add an assets entry with the path you need for the Assets controller in the securesocial package.

Jorge

ke...@scaldeferri.com

unread,
Aug 6, 2014, 9:20:47 PM8/6/14
to secure...@googlegroups.com
I'm stuck on this same problem.  To strip it down to the bare minimum, I tried with the demo app.  If I run the demo app from within the full securesocial build, it works and all the resources are found.  Next, I copied just the demo app out to a separate project and made the minimal changes so it would compile and run:

% diff -r -N -xtarget -xlogs -x\*~ ~/projects/securesocial/samples/scala/demo .  
diff -r -N -xtarget -xlogs -x'*~' /Users/kevin/projects/securesocial/samples/scala/demo/project/Common.scala ./project/Common.scala
0a1,8
> import sbt._
> import Keys._
> object Common {
>   def version = "master-SNAPSHOT"
>   def playVersion = System.getProperty("play.version", "2.3.1")
>   def scalaVersion =  System.getProperty("scala.version", "2.11.1")
> }
diff -r -N -xtarget -xlogs -x'*~' /Users/kevin/projects/securesocial/samples/scala/demo/scalaDemo.sbt ./scalaDemo.sbt
10a11
> lazy val root = (project in file(".")).enablePlugins(PlayScala)

When I run this, it displays the same resources not found problem above.  I also tried this change as you suggest:

diff -r -N -xtarget -xlogs -x'*~' /Users/kevin/projects/securesocial/samples/scala/demo/conf/routes ./conf/routes
14c14
< GET        /assets/*file        controllers.Assets.at(path="/public", file)
---
> GET        /assets/*file        controllers.Assets.at(path="/public/securesocial", file)


But that also had no effect.

I'm not an expert with Play plugins.  I'm not really sure how this is supposed to work with the assets.  Could you please explain how I would make the demo app work as a stand-alone project?


Thank you,

Kevin

Jorge Aliss

unread,
Aug 7, 2014, 2:18:17 PM8/7/14
to secure...@googlegroups.com
Thanks for the information Kevin.  I was able to reproduce the error and it only happens with Play 2.3.  I discovered that the public directory is not being packaged in the jar that gets published.  That is why the resources are not found, they are simply not there.  It's not a problem with your routes.

Packaging behavior has changed in Play 2.3 and I need to see what needs to be adjusted to have the assets included again when I publish the module.  As a work around, in the app using the module do:

1) Create a directory named "securesocial" under public.
2) Copy all the contents in the public/securesocial folder in the repo to your this directory.

Hope this helps,
Jorge

Borut

unread,
Aug 11, 2014, 3:09:17 AM8/11/14
to secure...@googlegroups.com

That's the same problem which I have been dealing with.
If you do the "Copy all the contents in the public/securesocial folder in the repo to your this directory", it works ok.

Borut

Devon Stewart

unread,
Mar 16, 2015, 2:44:16 AM3/16/15
to secure...@googlegroups.com
I'm not sure what the state of this bug is, but it seems like the Maven repository is tracking securesocial_2.11-3.0-M3-assets.jar, which contains all the required assets, but it doesn't seem to be included in the POM.


unzip ~/Downloads/securesocial_2.11-3.0-M3-assets.jar 'public/*'

Thank you,
-Devon

pitchblack408

unread,
Mar 17, 2015, 9:20:44 PM3/17/15
to secure...@googlegroups.com
I have been trying for an day to get this to run.  I tried to have it installed on 2.3.8.  My .sbt file has

name := """demo"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.1"

resolvers += Resolver.sonatypeRepo("snapshots")

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs,
  "ws.securesocial" %% "securesocial" % "master-SNAPSHOT"
)


I created a fresh project called demo. Then I moved all the app files and public files, config, routes, etc.. over for the demo/java that I got from the current snapshot on github snapshot.  I start by using activator run and then I see in the brower an error for the route file regraring all the @ signs. 

Parse: conf\securesocial.conf: 8: Reserved character '@' is not allowed outside quotes (if you intended '@' (Reserved character '@' is not allowed outside quotes) to be part of the value for 'host', try enclosing the value in double quotes, or you may be able to rename the file .properties rather than .conf)


Then I remove all the @ signs and attempt to run again and I get an error regarding the line missing the close brackets for the methods

value userAware is not a member of object controllers.Application

     In C:\Users\mmartin\play2\demo\conf\routes:7

    4
    5# Home page
    6GET        /                    controllers.Application.index
    7GET        /userAware           controllers.Application.userAware
    8GET        /only-twitter        controllers.Application.onlyTwitter
    9GET        /link-result         controllers.Application.linkResult
   10GET        /current-user        controllers.Application.currentUser



I then add the brackets on all the methods in the route file and rerun again and now I get another error

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

# Home page
GET / controllers.Application.index()
GET /userAware controllers.Application.userAware()
GET /only-twitter controllers.Application.onlyTwitter()
GET /link-result controllers.Application.linkResult()
GET /current-user controllers.Application.currentUser()

# Map static resources from the /public folder to the /assets URL path

GET /assets/*file controllers.Assets.at(path="/public", file)
->         /auth                securesocial.Routes




But now I get another error.....

value userAware is not a member of object controllers.Application

In C:\Users\mmartin\play2\demo\conf\routes:7

4 5# Home page 6GET / controllers.Application.index() 7GET /userAware controllers.Application.userAware() 8GET /only-twitter controllers.Application.onlyTwitter() 9GET /link-result controllers.Application.linkResult() 10GET /current-user controllers.Application.currentUser() 11 12

I don't know how to get this module to work and it seems like you have.  Can someone help me?

Reply all
Reply to author
Forward
0 new messages