Dean Hiller
Dean Hiller

Reputation: 20190

confusing playframework error on no routes

I have the error

No route able to invoke action premonitionx.Edits.postRelease with arguments {release=kjkjkj} was found

on this line of code

#{form @premonitionx.Edits.postRelease(projectName), id:'editrelease'}

when rendering my editRelease.html file as that file is for ADDS and EDITS.

My routes file is

GET  /{projectName}/{releaseName}/edit  premonitionx.Edits.editRelease
GET  /{projectName}/addrelease          premonitionx.Edits.editRelease
POST /{projectName}/saverelease     premonitionx.Edits.postRelease

My GET and POST methods are

public static void editRelease(String company, String projectName, String releaseName) {
    ReleaseDbo release = new ReleaseDbo();
    if(releaseName != null) {
        release = ReleaseDbo.findRelease(JPA.em(), company, projectName, releaseName);
    }

    render(company, projectName, release);
}

public static void postRelease(@Valid ReleaseDbo release, String projectName, String lastUrl) { 
          //do the post stuff I want
    }

Notice the only reference to the variable release is in the render method call and I do that on other locations in the code so what exactly is going on with my code here. play has been extremely reliable so far and most of my issues have been user error so what is my error this time as this one seems so far from the real issue?

LAST NOTE: renaming that release variable passed into render to xxxx changes the error to xxxx=kjkjkj BUT the release variable is NOT even of type String!!!! grrrrr, this must be a bug in 1.2.4 is all I can think. the projectName variable is a String and is supposed to be that value.

thanks, Dean

Upvotes: 2

Views: 921

Answers (1)

Dean Hiller
Dean Hiller

Reputation: 20190

okay, that is really really and may I say really dumb. It turns out this problem can be fixed by re-ordering the parameters in the method list....

Change the post method from

public static void postRelease(@Valid ReleaseDbo release, String projectName, String lastUrl) { 

to

public static void postRelease(String projectName, @Valid ReleaseDbo release, String lastUrl) { 

and then it works again.....ICK.....not enough magic going on there.

Upvotes: 3

Related Questions