Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

SpaceMetadataException: property must have a setter

Hello,

I'm having a strange issue. I wrote a class annotated with Gigaspaces annotations, and when I try to store it in the grid I get the aforementioned exception:

Exception in thread "main" org.openspaces.core.SpaceMetadataException: Invalid metadata for class ..., property ..: Space property must have a setter.
    at org.openspaces.core.exception.DefaultExceptionTranslator.internalTranslate(DefaultExceptionTranslator.java:123)
    at org.openspaces.core.exception.DefaultExceptionTranslator.translate(DefaultExceptionTranslator.java:49)
    at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:1054)
at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:1046)

but when I double check the class, it does have a setter for the property it mentions.

if I remove the @SpaceProperty tag from the getter method, the exception disappears, and the property is not stored.

I tried renaming the property, and the exception still appears with the new name.

I modified the serialVersionUID field to make sure client and server have the same version of the class.

I built, rebuilt, cleaned the server from the old jars, but nothing helps.

I also have a second issue with this same class.
once I remove @SpaceProperty from the property it complains for, I can store instances of this class, but there is another property, this one annotated with @SpaceProperty, which is set in the local instance to be stored, but it's null when I retrieve the instance from the grid.

any help with this will be greatly appreciated.

Kind Regards,

Raul

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2013-02-20 09:59:06 -0600

rdavidovich gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

Raul,

You might have an issue with the getter or setter methods for one of the fields.

Make sure all the fields you want the space to be familiar with to have setter and getter method. You should use the @SpaceProperty if you explicitly configured the SpaceClass to have its includeProperties=IncludeProperties.EXPLICIT (not recommended option) .

By default the IncludeProperties.IMPLICIT is used - This mode takes into account all POJO fields – even if a get method is not declared with a @SpaceProperty annotation, it is taken into account as a space field.

IncludeProperties.EXPLICIT takes into account only the get methods which are declared with a @SpaceProperty annotation.

See more here:

Shay

answered 2013-02-21 06:46:28 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hi Shay,

I found the issue. The property it was complaining for is a list of instances of a certain class hierarchy. In one of the concrete classes of this hierarchy there was a missing setter. Took me a while to figure this one out :)

Thank you for your help.

Raul

rdavidovich gravatar imagerdavidovich ( 2013-02-21 11:05:28 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-02-20 09:59:06 -0600

Seen: 320 times

Last updated: Feb 21 '13