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

  • Newbie problem - NotWritablePropertyException

    Hi,

    I'm encountering the following error when trying to set a property on a class which implements AfterReturningAdvice:

    junit.framework.AssertionFailedError: Exception in constructor: testSaveForm (org.springframework.beans.factory.BeanCreationExc eption: Error creating bean with name 'ldssTransactionAdvice' defined in class path resource [WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'serverTransactionManger' of bean class [com.lexmark.kiosk.dao.cyclone.LDSSTransactionAdvic e]: Property 'serverTransactionManger' is not writable
    org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'serverTransactionManger' of bean class [com.lexmark.kiosk.dao.cyclone.LDSSTransactionAdvic e]: Property 'serverTransactionManger' is not writable


    I have tried setting a property on another class, and it works fine - can anyone spot what I am doing wrong?

    many thanks,

    David

    application-context.xml:
    ---------------------------------------------------------------

    <bean id="ldssServerTransactionManger"
    class="com.lexmark.kiosk.dao.cyclone.LDSSTransacti onManager">
    </bean>

    <bean id="ldssTransactionAdvice"
    class="com.lexmark.kiosk.dao.cyclone.LDSSTransacti onAdvice">
    <property name="serverTransactionManger">
    <ref local="ldssServerTransactionManger"/>
    </property>
    </bean>

    <bean id="ldssTrasactionInterceptor"
    class="org.springframework.aop.support.RegexpMetho dPointcutAdvisor">
    <property name="advice">
    <ref local="ldssTransactionAdvice"/>
    </property>
    <property name="patterns">
    <list>
    <value>.*</value>
    </list>
    </property>
    </bean>

    <bean id="formsetDAO"
    class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces"><value>com.lexmark.kiosk.da o.FormsetDAO</value></property>

    <!-- Use inner bean, not local reference to target -->
    <property name="target">
    <bean class="com.lexmark.kiosk.dao.cyclone.FormsetDAOImp l"/>
    </property>

    <property name="interceptorNames">
    <list>
    <value>ldssTrasactionInterceptor</value>
    </list>
    </property>
    </bean>
    ---------------------------------------------------------------

    LDSSTransactionAdvice.java
    ---------------------------------------------------------------
    package com.lexmark.kiosk.dao.cyclone;

    import java.lang.reflect.Method;

    import org.springframework.aop.AfterReturningAdvice;

    public class LDSSTransactionAdvice implements AfterReturningAdvice
    {
    //register singleton through Spring
    private LDSSTransactionManager serverTransactionManager = null;

    public void setServerTransactionManager(LDSSTransactionManager serverTransactionManager)
    {
    this.serverTransactionManager = serverTransactionManager;
    }

    public void afterReturning(Object returnValue, Method m, Object[] args, Object target) throws Throwable
    {
    System.out.println("\n\nI'm here, having returned!!");
    }

    }
    ---------------------------------------------------------------

  • #2
    serverTransactionManger should read serverTransactionManager in application-context.xml

    Comment


    • #3
      AAAArrrrghhh!!

      I HATE those typos! Sorry for the bother.

      Comment

      Working...
      X