简体   繁体   中英

Play framework Missing Controller

I'm having a problem where the play framework just reports a "Missing Controller" even after I have created it.

[error] {file:/my/path/to/project/root/}Project Name/compile:sources: PlayException: Compilation error [Missing Controller] [error] Total time: 0 s, completed 26-Mar-2012 13:12:22

(I have removed the project name and file path)

Here is the relevant code

package controllers;

import play.mvc.Controller;
import play.mvc.Result;

public class cron extends Controller {

    private static Logger logger = java.util.logging.Logger.getLogger("uk.itvet.portal.CDR.CronJob");

    public static Result run() {
        return ok("Working");
    }
}

I have created a line in the routes config for the page

GET     /cron                       controllers.cron.run()

Any ideas?

for Play framework 1.0

  1. rename the class "cron" to "Cron"
  2. in run() method change return type to "void"
  3. in router file replace line by:

GET /cron Cron.run()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM