You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-user@geronimo.apache.org by gOrr <go...@gmail.com> on 2007/10/02 18:27:55 UTC

problems mapping attributes with xbean-spring-3.1

Hello.

I'm working with xbean-spring-3.1 in order to customize a Spring XML Config
file.

I'm attempting to map one attributes name, for instance:

package test;
public myClass {
  private String myAttribute:
  //getter and setter...
}

My configuration file should be something like:
<beans namespace_definition>
  <object attribute="att">
</beans>

In order to set up this, i'm using this file (META-INF/service/org....):
package= test
object= test.myClass
object.attribute=myAttribute

I received this exception:
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid
property 'attribute of bean class [test.myClass]: Bean property 'attribute'
is not writable or has an invalid setter method. Does the parameter type of
the setter match the return type of the getter?


I have tried with several xbean-spring version and I always get the same
result :(

Any idea?

Thanks in advance.

Re: problems mapping attributes with xbean-spring-3.1

Posted by MisterT <pv...@gmail.com>.
Did you ever work out what the problem was here? I'm having the same issue.

Does anyone else know the answer?

Regards,
Nick



gOrr wrote:
> 
> Hello.
> 
> I'm working with xbean-spring-3.1 in order to customize a Spring XML
> Config
> file.
> 
> I'm attempting to map one attributes name, for instance:
> 
> package test;
> public myClass {
>   private String myAttribute:
>   //getter and setter...
> }
> 
> My configuration file should be something like:
> <beans namespace_definition>
>   
> </beans>
> 
> In order to set up this, i'm using this file (META-INF/service/org....):
> package= test
> object= test.myClass
> object.attribute=myAttribute
> 
> I received this exception:
> Caused by: org.springframework.beans.NotWritablePropertyException: Invalid
> property 'attribute of bean class [test.myClass]: Bean property
> 'attribute'
> is not writable or has an invalid setter method. Does the parameter type
> of
> the setter match the return type of the getter?
> 
> 
> I have tried with several xbean-spring version and I always get the same
> result :(
> 
> Any idea?
> 
> Thanks in advance.
> 
> 

-- 
View this message in context: http://www.nabble.com/problems-mapping-attributes-with-xbean-spring-3.1-tp13002195p22060577.html
Sent from the xbean-user mailing list archive at Nabble.com.


Re: problems mapping attributes with xbean-spring-3.1

Posted by gOrr <go...@gmail.com>.
Get and Set methods have been autogenerated by eclipse:
 package test;
 public myClass {
   private String myAttribute:

   public void setMyAttribute(String myAttribute) {
      this.myAttribute=myAttribute;
   }

   public String getMyAttribute() {
      return myAttribute;
   }

 }

I guess that if the mapping "object.attribute=myAttribute" were working
correctly, the message error should be: "Invalid property 'myAttribute" of
bean class [ test.myClass]..." and not "Invalid property 'attribute" of bean
class [ test.myClass]...".

Thanks.


On 10/2/07, Jacek Laskowski <ja...@laskowski.net.pl> wrote:
>
> On 10/2/07, gOrr <go...@gmail.com> wrote:
>
> > package test;
> > public myClass {
> >   private String myAttribute:
> >   //getter and setter...
> > }
> ...
> > I received this exception:
> > Caused by: org.springframework.beans.NotWritablePropertyException:
> Invalid
> > property 'attribute of bean class [test.myClass]: Bean property
> 'attribute'
> > is not writable or has an invalid setter method. Does the parameter type
> of
> > the setter match the return type of the getter?
>
> Hi,
>
> Can you show the entire myClass class with setters and getters?
>
> Jacek
>
> --
> Jacek Laskowski
> http://www.JacekLaskowski.pl
>

Re: problems mapping attributes with xbean-spring-3.1

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On 10/2/07, gOrr <go...@gmail.com> wrote:

> package test;
> public myClass {
>   private String myAttribute:
>   //getter and setter...
> }
...
> I received this exception:
> Caused by: org.springframework.beans.NotWritablePropertyException: Invalid
> property 'attribute of bean class [test.myClass]: Bean property 'attribute'
> is not writable or has an invalid setter method. Does the parameter type of
> the setter match the return type of the getter?

Hi,

Can you show the entire myClass class with setters and getters?

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl