0
votes

I have just started doing play framework and i am missing some silly step over here.

I added new route in routes file but not able to access it. Also the CSS and JS is not loading when i open 127.0.0.1:9000 its plain text.

Following is what i did :-

  1. Added new route in routes :-

    GET     /test     controllers.Application.test()
    
  2. Added new method in Application :-

    public static Result test() {
       return ok("test2");
    }
    
  3. Did everything rest :-

    • ctrl + D (To stop play service)
    • play clean
    • play clean-all
    • play compile
    • play run

This is my play and scala version :-

  • play 2.2.1 built with Scala 2.10.2

I dont know what is going wrong but i did clean , clean-all and compile still i can not see the route in here. This is the latest play framework which i downloaded as of this date. play command has been added in my bash_profile and is working quite well.

I am using eclipse for development.

2
Can you please post the code of your routes and part of Application.java, where test() is defined? - arbuzz
It is mentioned above in point #2 . public static Result test() { return ok("test2"); } - abhishek
did you try introducing a syntax error to the routes file to see if sbt actually tries to compile it? And while you are on it :) could you make sure you actually saved the file? That happened to me more than once when I worked with sublime and forgot that it does not save the file automatically. Spend several hours wondering why my changes had no effect. - wallnuss
I can save the file though but if there is an error it gives the same output . I think sbt is not being cleaned or whatever the changes are not being reflected in any way - abhishek

2 Answers

0
votes

The route you added and the route you are trying do not seem to be the same.

  • The route you added : 127.0.0.1:9000/test
  • and the route you tried 127.0.0.1:9000
0
votes

Make sure that the routes file is under

<your-application/conf/routes

It appears that the framework is not reading your routes.

Also, it would try another name other than test. Not that this is necessarily the case with play but sometimes the test keyword tends to be used heavily for different purposes in code.