Search code examples
bashgrailsgsp

Missing property when trying to run a bash script in grails


I am trying to run a bash script through grails and i am stuck on a small error:

ERROR errors.GrailsExceptionResolver  - MissingPropertyException occurred when processing request: [GET] /FrameTest/loginKeys/index
No such property: loginKeysandFirstTest for class: frametest.LoginKeysController. Stacktrace follows:
groovy.lang.MissingPropertyException: No such property: loginKeysandFirstTest for class: frametest.LoginKeysController
    at frametest.LoginKeysController.index(LoginKeysController.groovy:11)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

in my controller this is what i am coding:

class LoginKeysController {

    def index() { 
        "sh /Users/ironmantis7x/testfiles/mashery_login.sh".execute().text
        render (view: loginKeysandFirstTest)
    }
}

and my gsp:

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="layout" content="main"/>
<title>Demo Test Run Results</title>
</head>
<body>
  <div class="body">

  </div>
</body>
</html>

What am i missing that is tripping this error in grails? I am running ggts with grails 2.4.4.

Thanks.

ironmantis7x


Solution

  • The issue isn't with running sh. Take a closer look at the error:

    No such property: loginKeysandFirstTest for class: frametest.LoginKeysController

    No such property: loginKeysandFirstTest for class: frametest.LoginKeysController

    The problem is with the line right after running sh:

    render (view: loginKeysandFirstTest)
    

    The view parameter expects the name of a view. So if the view is named loginKeysandFirstTest, then you can call render with that name as a String, like this:

    render (view: 'loginKeysandFirstTest')