PDA

View Full Version : Newbie problem - NotWritablePropertyException



hay7777
Aug 31st, 2004, 03:26 PM
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.LDSSTransactionManag er">
</bean>

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

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

<bean id="formsetDAO"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"><value>com.lexmark.kiosk.dao.FormsetDAO</value></property>

<!-- Use inner bean, not local reference to target -->
<property name="target">
<bean class="com.lexmark.kiosk.dao.cyclone.FormsetDAOImpl"/>
</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!!");
}

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

irbouho
Aug 31st, 2004, 03:37 PM
serverTransactionManger should read serverTransactionManager in application-context.xml ;)

hay7777
Aug 31st, 2004, 05:01 PM
AAAArrrrghhh!!

I HATE those typos! Sorry for the bother.