Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Bean property 'xx' is not writable or has an invalid setter?

  1. #11
    Join Date
    Mar 2010
    Posts
    3

    Default

    I had the same problem when migrating Spring to a new Version. Look for stray JAR-files from old versions. In my case it was a dependency introduced by jaxws-spring through maven

  2. #12
    Join Date
    Dec 2010
    Posts
    13

    Default Similar error

    Following is the validatior I am using :

    <bean id="validator"
    class="org.springframework.batch.item.validator.Sp ringValidator">
    <property name="billingTransactionId">
    <bean id="luhnValidator" class="org.springmodules.validation.valang.ValangV alidator">
    <property name="valang">
    <value>
    <![CDATA[{ billingTransactionId : ? < 33 : 'billingTransactionId field must be a grater that 33 number' } ]]>
    </value>
    </property>
    </bean>
    </property>
    </bean>


    I am getting error :
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'compositeItemProcessor' defined in class path resource [MedJobValidation.xml]: Cannot resolve reference to bean 'validatingItemProcessor' while setting bean property 'itemProcessors' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'validatingItemProcessor' defined in class path resource [MedJobValidation.xml]: Cannot resolve reference to bean 'validator' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'validator' defined in class path resource [MedJobValidation.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'billingTransactionId' of bean class [org.springframework.batch.item.validator.SpringVal idator]: Bean property 'billingTransactionId' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:275)


    What is causing the error ?

  3. #13
    Join Date
    Jan 2012
    Posts
    8

    Default

    Hi,

    Could you please help somebody for this issue?

    I am getting the following exception when I run the TestCases using Maven. Actually we have migrated from

    Spring 2.5.4 to Spring 3.0.6
    hibernate 3.1.3 to Hibernate 3.6.6.

    Exception Log:
    16976 [main] ERROR org.springframework.test.context.TestContextManage r - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener@4cbcaf] to prepare test instance [com.xxx.yyy.zzz.common.dao.hibernate.Activa tionCodeDAOTest@183698f]
    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:308)
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.injectDependencies (DependencyInjectionTestExecutionListener.java:109 )
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.prepareTestInstanc e(DependencyInjectionTestExecutionListener.java:75 )
    at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:321)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:211)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:287)
    at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.methodBlock(SpringJUnit4ClassRunner. java:289)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner. java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:184)
    at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:28)
    at org.springframework.test.context.junit4.statements .RunBeforeTestClassCallbacks.evaluate(RunBeforeTes tClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements .RunAfterTestClassCallbacks.evaluate(RunAfterTestC lassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.ja va:236)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:174 )
    at org.apache.maven.surefire.junit4.JUnit4TestSet.exe cute(JUnit4TestSet.java:62)
    at org.apache.maven.surefire.suite.AbstractDirectoryT estSuite.executeTestSet(AbstractDirectoryTestSuite .java:140)
    at org.apache.maven.surefire.suite.AbstractDirectoryT estSuite.execute(AbstractDirectoryTestSuite.java:1 27)
    at org.apache.maven.surefire.Surefire.run(Surefire.ja va:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.maven.surefire.booter.SurefireBooter.ru nSuitesInProcess(SurefireBooter.java:345)
    at org.apache.maven.surefire.booter.SurefireBooter.ma in(SurefireBooter.java:1009)
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.transaction.interceptor.Trans actionInterceptor#0': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'transactionManagerBeanName' of bean class [org.springframework.transaction.interceptor.Transa ctionInterceptor]: Bean property 'transactionManagerBeanName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1361)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 93)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:290 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:84)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:1)
    at org.springframework.test.context.TestContext.loadA pplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:304)
    ... 29 more
    Caused by: org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'transactionManagerBeanName' of bean class [org.springframework.transaction.interceptor.Transa ctionInterceptor]: Bean property 'transactionManagerBeanName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:1052)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:921)
    at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:7 6)
    at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:5 8)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1358)
    ... 43 more

    configuration:
    ------------------
    spring-transaction.xml
    <!-- Turn on annotation based transactions -->
    <tx:annotation-driven />

    <bean id="transactionManager"
    class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    spring-xxx-tests.xml
    -----------------------
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@//xxx:yyy/zzzz"/>
    <property name="username" value="xxxx" />
    <property name="password" value="yyyy" />
    <property name="defaultTransactionIsolation" value="2"/>
    </bean>

    <bean id="systemDAO"
    class="com.test.common.dao.hibernate.impl.TestSyst emDAOImpl">
    <property name="sessionFactory" ref="sessionFactory" />
    <property name="databasePropertyPlaceholderConfigurer" ref="databasePropertyPlaceholderConfigurer"/>
    </bean>

    <!-- Beans listed here don't override but are specific to tests. -->
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
    <property name="dataSource" ref="dataSource" />
    </bean>
    Last edited by chaatna; Jan 10th, 2012 at 10:46 PM.

  4. #14
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    284

    Default

    This is definitely a problem with incompatible jar versions. Check if you have changed all the spring jar versions to the latest (i.e. spring-orm)

    Please use tags when you post code
    Amila Domingo

  5. #15
    Join Date
    Jan 2012
    Posts
    8

    Default

    Hi Amingo,

    I am using same version of spring jars for spring-orm also. Please find the same:

    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>${spring.version}</version>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-orm</artifactId>
    <version>${spring.version}</version>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-oxm</artifactId>
    <version>${spring.version}</version>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>${spring.version}</version>
    <scope>test</scope>
    </dependency>
    do we need to really configure "org.springframework.transaction.interceptor.Trans actionProxyFactoryBean"?

    Thanks in advance.
    Chaatna

  6. #16
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    284

    Default

    Didi you try changing to the latest (spring 3.1 and hibernate 4)?
    Amila Domingo

  7. #17
    Join Date
    Jan 2012
    Posts
    8

    Question

    Hi Amila,

    Could I know whether there's any fix for this issue in higher versions? Actually this issue is occuring only for JUnit Test Cases only. We can go ahead with those versions If the higher versions have fix. otherwise it requires lot of effort to get those jars where we can;t download manually being using maven to get from common artifactory.

    Thanks in advance.

    Regards,
    Chaatna

  8. #18
    Join Date
    Jan 2012
    Posts
    8

    Post

    Hi Amila,

    Please find my BaseSpringTestCase code:

    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations = {"classpath:spring-tests.xml"})
    @TransactionConfiguration(transactionManager="tran sactionManager", defaultRollback=true)
    @Transactional
    public abstract class BaseSpringTest extends BaseTest {

    @Resource(name="hibernateTemplate")
    HibernateTemplate hibernateTemplate;

    @After
    public void afterTest() {
    hibernateTemplate.getSessionFactory().getCurrentSe ssion().flush();
    hibernateTemplate.getSessionFactory().getCurrentSe ssion().clear();
    }

    }

    Please help in this.

    Thanks,
    Chaatna

  9. #19
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    284

    Default

    Do you run this test through eclipse? if so check if eclipse classpath refers the new jars you added
    Amila Domingo

  10. #20
    Join Date
    Jan 2012
    Posts
    8

    Question

    Hi Amila,

    We are building through Maven by getting the jars from from common repository in a secured environment. That too those are not newly added jars. Those dependencies present from the beginning for application also.

    Could you please let me know how to proceed with maven build?

    Thanks,
    Chaatna

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •