problem using grails

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem using grails

Sergio Rafael Gianazza
Hi, I've made my first Grail Application, and I'm getting the following error:

 org.codehaus.groovy.runtime.InvokerInvocationException:
java.lang.NullPointerException at
org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:654)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:343) at
groovy.lang.Closure.call(Closure.java:176) at
groovy.lang.Closure.call(Closure.java:171) at
org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.handleAction(SimpleGrailsControllerHelper.java:353)
at
.....

when I'm trying to execute:

[ manage : Rol.findAll() ]

I've a Domain named Rol:

class Rol {
        @Property Long id
        @Property String rolname
       
// @Property Long version

    String toString() { "${this.class.name} :  $id" }
}


and a Controller named RolController:

class RolController {

        @Property index = {
                redirect(action: manage)
         }
       
        @Property manage = {
                [ manage : Rol.findAll() ]
        }
}

and a manage.jsp page (under views/rol directory) that looks like:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Alta de Roles</title>
</head>

<body>
        <table>
                <tr>
                        <th>ID</th>
                        <th>Nombre</th>
                </tr>
                <%rol.each {%>
                        <tr>${it.id}</tr>
                        <tr>${it.rolname}</tr>
                <%} %>
        </table>
       
        <form name="alta" method="post">
                Nombre de Rol: <input type="text" name="nombre"/>
        </form>
</body>

</html>


I know that the page doesn't compile, but the problem seems to be in
the controller, can you give me a clue about this problem?

P.d.: sorry for my english.






--
:: Sergio Rafael Gianazza
::    [hidden email]
::
::You employ stone, wood and concrete, and with this materials you
::build houses and palaces. That is construction. Ingenuity is at work.
::But suddenly you touch my heart, you do me good, I am happy and
::I say "This is beautiful." That is Architecture.
::
::         -Le Corbusier, 1923
Reply | Threaded
Open this post in threaded view
|

Re: problem using grails

graemer
The problem could be due to your domain class having the version
property commented out as this property is needed for mapping to take
place

Otherwise please post the ful stack trace

Graeme

On 4/24/06, Sergio Rafael Gianazza <[hidden email]> wrote:

> Hi, I've made my first Grail Application, and I'm getting the following error:
>
>  org.codehaus.groovy.runtime.InvokerInvocationException:
> java.lang.NullPointerException at
> org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:654)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:343) at
> groovy.lang.Closure.call(Closure.java:176) at
> groovy.lang.Closure.call(Closure.java:171) at
> org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.handleAction(SimpleGrailsControllerHelper.java:353)
> at
> .....
>
> when I'm trying to execute:
>
> [ manage : Rol.findAll() ]
>
> I've a Domain named Rol:
>
> class Rol {
>         @Property Long id
>         @Property String rolname
>
> //      @Property Long version
>
>     String toString() { "${this.class.name} :  $id" }
> }
>
>
> and a Controller named RolController:
>
> class RolController {
>
>         @Property index = {
>                 redirect(action: manage)
>          }
>
>         @Property manage = {
>                 [ manage : Rol.findAll() ]
>         }
> }
>
> and a manage.jsp page (under views/rol directory) that looks like:
>
> <%@ page language="java" contentType="text/html; charset=UTF-8"
>     pageEncoding="UTF-8"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>Alta de Roles</title>
> </head>
>
> <body>
>         <table>
>                 <tr>
>                         <th>ID</th>
>                         <th>Nombre</th>
>                 </tr>
>                 <%rol.each {%>
>                         <tr>${it.id}</tr>
>                         <tr>${it.rolname}</tr>
>                 <%} %>
>         </table>
>
>         <form name="alta" method="post">
>                 Nombre de Rol: <input type="text" name="nombre"/>
>         </form>
> </body>
>
> </html>
>
>
> I know that the page doesn't compile, but the problem seems to be in
> the controller, can you give me a clue about this problem?
>
> P.d.: sorry for my english.
>
>
>
>
>
>
> --
> :: Sergio Rafael Gianazza
> ::    [hidden email]
> ::
> ::You employ stone, wood and concrete, and with this materials you
> ::build houses and palaces. That is construction. Ingenuity is at work.
> ::But suddenly you touch my heart, you do me good, I am happy and
> ::I say "This is beautiful." That is Architecture.
> ::
> ::                                                   -Le Corbusier, 1923
>
Reply | Threaded
Open this post in threaded view
|

Re: problem using grails

Sergio Rafael Gianazza
that seems to fix the problem.

Thanks!!


On 4/24/06, Graeme Rocher <[hidden email]> wrote:

> The problem could be due to your domain class having the version
> property commented out as this property is needed for mapping to take
> place
>
> Otherwise please post the ful stack trace
>
> Graeme
>
> On 4/24/06, Sergio Rafael Gianazza <[hidden email]> wrote:
> > Hi, I've made my first Grail Application, and I'm getting the following error:
> >
> >  org.codehaus.groovy.runtime.InvokerInvocationException:
> > java.lang.NullPointerException at
> > org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:654)
> > at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:343) at
> > groovy.lang.Closure.call(Closure.java:176) at
> > groovy.lang.Closure.call(Closure.java:171) at
> > org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.handleAction(SimpleGrailsControllerHelper.java:353)
> > at
> > .....
> >
> > when I'm trying to execute:
> >
> > [ manage : Rol.findAll() ]
> >
> > I've a Domain named Rol:
> >
> > class Rol {
> >         @Property Long id
> >         @Property String rolname
> >
> > //      @Property Long version
> >
> >     String toString() { "${this.class.name} :  $id" }
> > }
> >
> >
> > and a Controller named RolController:
> >
> > class RolController {
> >
> >         @Property index = {
> >                 redirect(action: manage)
> >          }
> >
> >         @Property manage = {
> >                 [ manage : Rol.findAll() ]
> >         }
> > }
> >
> > and a manage.jsp page (under views/rol directory) that looks like:
> >
> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> >     pageEncoding="UTF-8"%>
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> > <title>Alta de Roles</title>
> > </head>
> >
> > <body>
> >         <table>
> >                 <tr>
> >                         <th>ID</th>
> >                         <th>Nombre</th>
> >                 </tr>
> >                 <%rol.each {%>
> >                         <tr>${it.id}</tr>
> >                         <tr>${it.rolname}</tr>
> >                 <%} %>
> >         </table>
> >
> >         <form name="alta" method="post">
> >                 Nombre de Rol: <input type="text" name="nombre"/>
> >         </form>
> > </body>
> >
> > </html>
> >
> >
> > I know that the page doesn't compile, but the problem seems to be in
> > the controller, can you give me a clue about this problem?
> >
> > P.d.: sorry for my english.
> >
> >
> >
> >
> >
> >
> > --
> > :: Sergio Rafael Gianazza
> > ::    [hidden email]
> > ::
> > ::You employ stone, wood and concrete, and with this materials you
> > ::build houses and palaces. That is construction. Ingenuity is at work.
> > ::But suddenly you touch my heart, you do me good, I am happy and
> > ::I say "This is beautiful." That is Architecture.
> > ::
> > ::                                                   -Le Corbusier, 1923
> >
>


--
:: Sergio Rafael Gianazza
::    [hidden email]
::
::You employ stone, wood and concrete, and with this materials you
::build houses and palaces. That is construction. Ingenuity is at work.
::But suddenly you touch my heart, you do me good, I am happy and
::I say "This is beautiful." That is Architecture.
::
::         -Le Corbusier, 1923