6

I am just trying to follow along with the ZenTasks tutorial (http://www.playframework.com/documentation/2.1.0/JavaGuide4) for the Play Framework. I can't seem to even get the Login page to work however.

I am running this project with the play ~run command. When navigating to http://localhost:9000/login the error is

Action not found For request 'GET /login'
These routes have been tried, in this order:
1 GET/controllers.Application.index()
2 GET/assets/$file<.+>controllers.Assets.at(path:String = "/public", file:String)`

My routes file looks like

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

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

# User athentication
GET     /login                      controllers.Application.login()
POST    /login                      controllers.Application.authenticate()
GET     /logout                     controllers.Application.logout()

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

and the Application.login, authenticate, and logout functions all compile properly. Am I missing something incredibly easy here, because I can't tell what is going wrong?

7
  • No, your routes file looks fine. Could you try restartig your Play application?
    – Carsten
    Commented May 23, 2013 at 5:25
  • Have you started the right application? It seems that there are only 2 routes detected in your route file and those 2 routes are the default routes present in a newly generated project. Commented May 23, 2013 at 8:11
  • @Carsten I have restarted my application.
    – Bert B.
    Commented May 23, 2013 at 15:00
  • @i.am.michiel, I was thinking the same thing it. It is as if it is not detecting any changes. I definitely started the right application, this is my one and only Play application. I can get the index page to work fine, but none of the login or logout routes work. Any other possible suggestions?
    – Bert B.
    Commented May 23, 2013 at 15:00
  • Okay let's see...the file is called routes and lies in the conf directory? What happens if you deliberately introduce some syntax errors to the file and then reload (or restart the application)?
    – Carsten
    Commented May 23, 2013 at 15:10

3 Answers 3

8

Looks like the routes file wasn't compiled properly. probably, you should do a clean in the play console and try again

$ play clean-all
1
  • If you have activator, you can do activator clean Commented May 8, 2017 at 11:55
4

@DiAlex

Just in case play clean-all doesn't work, you can try to

$ clean 

then

$ compile

within the play console.

However, I think both of them do the same thing.

1
  • No, Compile does additional works in the comparison with clean command. Commented Oct 16, 2018 at 13:13
1

If you are using play framework via Activator you can simply do the follow steps:

  1. sbt clean
  2. activator run

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.