Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action not found in play framework

I've just created a new play framework project and it runs fine. Now, once I modify my routes file (all I'm doing is adding the GET /popular line):

# Home page
GET     /popular                    controllers.Application.popular()
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)

Now in my controller, I add the handler:

public class Application extends Controller {

    public static Result index() {
        return ok(index.render("Your new application is ready."));
    }

    public static Result popular() {

        ArrayList<String> popular = new ArrayList<String>();
        popular.add("testing");
        popular.add("123");
        return ok(Json.toJson(popular));
    }
}

For some reason, I'm getting a 'Action not found' when trying to access http://127.0.0.1:9000/popular.

I just wanted to try out a simple action. Any idea why I'm getting this error?

like image 851
Henrique Avatar asked Oct 02 '22 11:10

Henrique


1 Answers

Apparently going into the play console and executing a clean command fixes this. If this doesn't work, try also manually executing a compile command.

like image 137
Henrique Avatar answered Oct 08 '22 00:10

Henrique