Announcement Announcement Module
Collapse
No announcement yet.
NotWritableProperty Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NotWritableProperty

    I created a simple component, but am unable to set properties:

    class:
    public class Component {
    private int value;
    public void setValue(int value) { this.value = value; }
    public int getValue() { return value; }
    }

    And wired it with:
    <beans>
    <bean id="componentBean" class="somepath.Component">
    <property name="value">
    <value>34</value>
    </property>
    </bean>
    </beans>

    And when I lauch it, I get NotWritablePropertyException (property 'value' is not writable)

    Now I feel completely silly not being able to correct it.
    I have included all sorts of jars (in case some dynamics was missing)
    I have tried String value, int value, Integer value

    Which obvious part have I forgotten?

  • #2
    Strange - this works fine for me in Spring 1.1, java version "1.4.2_03".
    Do you have any more of the trace?

    Comment


    • #3
      Any chance some older version of the class is actually being created? The not writable error happens for example when there is no such property, which could be the case if you are actually creating another version (older, with no such property) of the class than you think you are...

      Comment


      • #4
        I had tested the legacy option using "rm -rf /", so it took me some time to reproduce it (Just a joke).

        I had ensured that it was the genuine class file. I could instantiate the bean without setting the properties, but using properties or even constructor-arg fails with not writable.

        If I created component Comp2, it worked fine. So, the problem might be much more subtle than I initially thought. Creating a component dk.logical.Component fails on all properties, dk.logical.Comp2 does not..

        I am glad that I was not a complete novice, but I do not know if I am close to an issue.

        Comment


        • #5
          If you can create a testcase which duplicates the problem, and upload it to JIRA, we can take a look at it. This is a very simple case as far as I can tell, so I don't know what else to suggest.

          Comment


          • #6
            SPR 348..

            Comment


            • #7
              Works fine for me (I copied the log to a comment in the JIRA entry).

              Comment

              Working...
              X