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

  • Error creating bean

    here is my bean config
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    
    	<bean id="viewResolver"
    		class="org.springframework.web.servlet.view.InternalResourceViewResolver"
    		p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
    
    	<bean id="messageSource"
    		class="org.springframework.context.support.ResourceBundleMessageSource"
    		p:basename="messages" />
    
    	<bean id="userService" class="com.rokon.service.UserServiceImpl" />
    
    	<bean id="userValidator" class="com.rokon.validator.UserValidator" />
    
    	<bean id="getSalary" class="com.rokon.service.GetSalaryImpl"></bean>
    	
    	<bean id="salaryValidator" class="com.rokon.validator.SalaryValidator"></bean>
    	
    	<bean name="/userRegistration.htm" class="com.rokon.web.UserController"
    		p:userService-ref="userService" p:formView="userForm" p:successView="userSuccess"
    		p:validator-ref="userValidator" />
    
    	<bean name="/salarySheet.htm" class="com.rokon.web.SalrayController"
    		p:userService-ref="getSalary" p:formView="salraySheet" p:successView="salarySheetSuccess"
    		p:validator-ref="salaryValidator" />
    </beans>
    I got some exception..

    stacktrace is here

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '/salarySheet.htm' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'userService' of bean class [com.rokon.web.SalrayController]: Bean property 'userService' 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:1278)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1011)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:412)
    at java.security.AccessController.doPrivileged(Native Method)

    Caused by: org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'userService' of bean class [com.rokon.web.SalrayController]: Bean property 'userService' 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:787)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:643)
    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:1275)
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/salarySheet.htm' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userService' of bean class [com.rokon.web.SalrayController]: Bean property 'userService' 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.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1278)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1011)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412)
    	at java.security.AccessController.doPrivileged(Native Method)

    Caused by: org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'userService' of bean class [com.rokon.web.SalrayController]: Bean property 'userService' 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:787)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:643)
    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:1275)

    Can anyone tell me please why is this going on.......

  • #2
    oho.. I solve it.... problem was here

    Code:
    <bean name="/salarySheet.htm" class="com.rokon.web.SalrayController"
    		p:userService-ref="getSalary" p:formView="salraySheet" p:successView="salarySheetSuccess"
    		p:validator-ref="salaryValidator" />
    p:userService-ref="getSalary" will be p:getSalary-ref="getSalary"

    Comment

    Working...
    X