No such property: save for class ...

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

No such property: save for class ...

Stephen Souness
In an application that was recently upgraded to use Grails 1.1.1, I have struck an issue where a groovy.lang.MissingPropertyException is thrown if I try to save a newly instantiated domain object inside a service called by the controller of another domain object.

The exact same code works fine if I create an instance of the class from its own controller before visiting the page backed by the controller.

It seems like whatever is responsible for dynamically adding the GORM functionality to the domain object hasn't detected that it needs to work its magic before my service comes along.
Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Graeme Rocher-3
You able to create an issue that reproduces the problem?

Sent from my iPhone

On 22 May 2009, at 11:08, Stephen Souness <[hidden email]> wrote:

>
> In an application that was recently upgraded to use Grails 1.1.1, I  
> have
> struck an issue where a groovy.lang.MissingPropertyException is  
> thrown if I
> try to save a newly instantiated domain object inside a service  
> called by
> the controller of another domain object.
>
> The exact same code works fine if I create an instance of the class  
> from its
> own controller before visiting the page backed by the controller.
>
> It seems like whatever is responsible for dynamically adding the GORM
> functionality to the domain object hasn't detected that it needs to  
> work its
> magic before my service comes along.
>
> --
> View this message in context: http://www.nabble.com/No-such-property%3A-save-for-class-...-tp23667707p23667707.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Stephen Souness
Hi Graeme,

I'll have a go at extracting the offending code out and reducing it down to the simplest example that reproduces the problem and consider filing a Jira.

In the mean time, here is a stack trace (names changed to protect the innocent) - in case that reveals anything.


groovy.lang.MissingPropertyException: No such property: save for class: names.changed.here.LittlePicture

        at names.changed.here.BigPictureService.createBigPicture(BigPictureService.groovy:52)

        at names.changed.here.BigPictureService$$FastClassByCGLIB$$c8672998.invoke(<generated>)

        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)

        at names.changed.here.BigPictureService$$EnhancerByCGLIB$$26c00634.createBigPicture(<generated>)

        at names.changed.here.BigPictureService$createBigPicture.call(Unknown Source)

        at names.changed.here.BigPictureInfoController$_closure8.doCall(BigPictureController.groovy:112)

        at names.changed.here.BigPictureInfoController$_closure8.call(BigPictureController.groovy)


--
Stephen


Graeme Rocher-3 wrote
You able to create an issue that reproduces the problem?

Sent from my iPhone

On 22 May 2009, at 11:08, Stephen Souness <sounie@hotmail.com> wrote:

>
> In an application that was recently upgraded to use Grails 1.1.1, I  
> have
> struck an issue where a groovy.lang.MissingPropertyException is  
> thrown if I
> try to save a newly instantiated domain object inside a service  
> called by
> the controller of another domain object.
>
> The exact same code works fine if I create an instance of the class  
> from its
> own controller before visiting the page backed by the controller.
>
> It seems like whatever is responsible for dynamically adding the GORM
> functionality to the domain object hasn't detected that it needs to  
> work its
> magic before my service comes along.
>
> --
> View this message in context: http://www.nabble.com/No-such-property%3A-save-for-class-...-tp23667707p23667707.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Marcus Better
In reply to this post by Stephen Souness
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen Souness wrote:
> In an application that was recently upgraded to use Grails 1.1.1, I have
> struck an issue where a groovy.lang.MissingPropertyException is thrown if
> I try to save a newly instantiated domain object inside a service called
> by the controller of another domain object.

I have the same issue when saving a new User in a RegisterController which is basically the one generated by the Acegi plugin.

Not sure how to reproduce. It goes away after restarting the app server (Tomcat).

2009-05-19 14:03:48,032 [http-8082-exec-1] ERROR StackTrace  - Sanitizing stacktrace:
groovy.lang.MissingPropertyException: No such property: save for class: User
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
        at
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:107)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:192)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:204)
        at
org.codehaus.groovy.grails.plugins.orm.hibernate.HibernatePluginSupport$_enhanceProxy_closure2.doCall(HibernatePluginSupport.groovy:243)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:81)
        at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:826)
        at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1111)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1064)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:926)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:893)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)
        at RegisterController$_closure5.doCall(RegisterController.groovy:166)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoWi+cACgkQXjXn6TzcAQn/RgCgksUv6oJNJ2elIqq9K/DnngFT
/SYAoK+/FoUgYq2PbWvAxmNndYsXfCj3
=uW5O
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Robert Fletcher
In reply to this post by Stephen Souness
MissingPropertyException implies you are missing the brackets from save().

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Marcus Better
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Fletcher wrote:
> MissingPropertyException implies you are missing the brackets from save().

I'm not, and I assume he isn't either.

Cheers,

Marcus

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoWjTgACgkQXjXn6TzcAQkoZACgmCne4xGxNFrnzIY8/cDyBfHV
+NMAniWhPzm1iCENQRI4a1kbN8++oPK/
=g9Gf
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Stephen Souness
Brackets are there - even though they are not required.


Marcus Better wrote
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Fletcher wrote:
> MissingPropertyException implies you are missing the brackets from save().

I'm not, and I assume he isn't either.

Cheers,

Marcus

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoWjTgACgkQXjXn6TzcAQkoZACgmCne4xGxNFrnzIY8/cDyBfHV
+NMAniWhPzm1iCENQRI4a1kbN8++oPK/
=g9Gf
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Marcus Better
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen Souness wrote:
> Brackets are there - even though they are not required.

You mean for the save() call? I don't see how that would work without
parentheses.

Cheers,

Marcus

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoWlvQACgkQXjXn6TzcAQnTdwCgtO7DFJyP0TRbQeFLB55FWwdG
9UgAoMM9BOEnmisnuz1T88uAiFhiHfnS
=Jclu
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Stephen Souness
I stand corrected on the parenthesis issue - only optional if there is at least 1 argument and it is not ambiguous.

The crux of the original problem appears to be that we are attempting to create and store an object that Gorm hasn't seen yet.

We're not listing or presenting the user with any information from the database related to the "names.changed.here.LittlePicture" object.  Adding a call in BootStrap.groovy along the lines of LittlePicture.get(-1) is our current workaround, but it's a kludge.

--
Stephen


Marcus Better wrote
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen Souness wrote:
> Brackets are there - even though they are not required.

You mean for the save() call? I don't see how that would work without
parentheses.

Cheers,

Marcus

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoWlvQACgkQXjXn6TzcAQnTdwCgtO7DFJyP0TRbQeFLB55FWwdG
9UgAoMM9BOEnmisnuz1T88uAiFhiHfnS
=Jclu
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Mateusz Mrozewski
Can you try to recompile your domain class? Remove the old one first.
It helped me twice.

Cheers,
Mateusz

On Fri, May 22, 2009 at 2:36 PM, Stephen Souness <[hidden email]> wrote:

>
> I stand corrected on the parenthesis issue - only optional if there is at
> least 1 argument and it is not ambiguous.
>
> The crux of the original problem appears to be that we are attempting to
> create and store an object that Gorm hasn't seen yet.
>
> We're not listing or presenting the user with any information from the
> database related to the "names.changed.here.LittlePicture" object.  Adding a
> call in BootStrap.groovy along the lines of LittlePicture.get(-1) is our
> current workaround, but it's a kludge.
>
> --
> Stephen
>
>
>
> Marcus Better wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Stephen Souness wrote:
>>> Brackets are there - even though they are not required.
>>
>> You mean for the save() call? I don't see how that would work without
>> parentheses.
>>
>> Cheers,
>>
>> Marcus
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>>
>> iEYEARECAAYFAkoWlvQACgkQXjXn6TzcAQnTdwCgtO7DFJyP0TRbQeFLB55FWwdG
>> 9UgAoMM9BOEnmisnuz1T88uAiFhiHfnS
>> =Jclu
>> -----END PGP SIGNATURE-----
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/No-such-property%3A-save-for-class-...-tp23667707p23669609.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Mateusz Mrozewski

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

christian.noack
Hi,

I had exactly the same problem. Recompiling the domain class did not solve the issue for me. But the workaround (MyDomainClass.get(-1) in BootStrap.groovy) worked. I'm quite concerned about that. It by the end of june right now and there still is not fix for that.

Best regards,

Christian
Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Graeme Rocher-3
On Tue, Jun 23, 2009 at 9:38 AM,
christian.noack<[hidden email]> wrote:
>
> Hi,
>
> I had exactly the same problem. Recompiling the domain class did not solve
> the issue for me. But the workaround (MyDomainClass.get(-1) in
> BootStrap.groovy) worked. I'm quite concerned about that. It by the end of
> june right now and there still is not fix for that.

It is fixed in github HEAD and will be in the next milestone of 1.2

>
> Best regards,
>
> Christian
> --
> View this message in context: http://www.nabble.com/No-such-property%3A-save-for-class-...-tp23667707p24162093.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Head of Grails Development
SpringSource - Weapons for the War on Java Complexity
http://www.springsource.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: No such property: save for class ...

Fred Janon
I get this error for several domain classes in a deployed application, I see it in the Stacktrace.log.

Questions:
1) is the "MyDomainClass.get(-1) in BootStrap.groovy)" a real workaround for 1.1.1?
2) Once the "save" exception has occured, do we have to restart the application to get "save" to work again?

Thanks

Fred

On Tue, Jun 23, 2009 at 16:56, Graeme Rocher <[hidden email]> wrote:
On Tue, Jun 23, 2009 at 9:38 AM,
christian.noack<[hidden email]> wrote:
>
> Hi,
>
> I had exactly the same problem. Recompiling the domain class did not solve
> the issue for me. But the workaround (MyDomainClass.get(-1) in
> BootStrap.groovy) worked. I'm quite concerned about that. It by the end of
> june right now and there still is not fix for that.

It is fixed in github HEAD and will be in the next milestone of 1.2

>
> Best regards,
>
> Christian
> --
> View this message in context: http://www.nabble.com/No-such-property%3A-save-for-class-...-tp23667707p24162093.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Head of Grails Development
SpringSource - Weapons for the War on Java Complexity
http://www.springsource.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email