主题:菜鸟求助spring配置问题
访问网页时报错如下:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error creating bean with name 'usersmanager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'usersdao' of bean class [com.loginsystem.service.impl.usersmanagerimpl]: Bean property 'usersdao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usersmanager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'usersdao' of bean class [com.loginsystem.service.impl.usersmanagerimpl]: Bean property 'usersdao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1130)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:82)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
org.apache.catalina.startup.Catalina.start(Catalina.java:551)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
root cause
org.springframework.beans.NotWritablePropertyException: Invalid property 'usersdao' of bean class [com.loginsystem.service.impl.usersmanagerimpl]: Bean property 'usersdao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:793)
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:82)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
org.apache.catalina.startup.Catalina.start(Catalina.java:551)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
我的xml配置如下:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/fan"></property>
<property name="username" value="root"></property>
<property name="password" value="19861005"></property>
</bean>
<bean id="usersdao" class="com.loginsystem.dao.jdbc.usersdaoimpl">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
<bean id="usersmanager"
class="com.loginsystem.service.impl.usersmanagerimpl" abstract="false"
singleton="true" lazy-init="default" autowire="default"
dependency-check="default">
<property name="usersdao">
<ref bean="usersdao" />
</property>
</bean>
我在class usersmanagerimpl里面写的set方法
private usersdao dao;
public void setDao(usersdao usersdao) {
this.dao = usersdao;
}
哪位能帮我看看是什么问题呢?
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error creating bean with name 'usersmanager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'usersdao' of bean class [com.loginsystem.service.impl.usersmanagerimpl]: Bean property 'usersdao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usersmanager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'usersdao' of bean class [com.loginsystem.service.impl.usersmanagerimpl]: Bean property 'usersdao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1130)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:82)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
org.apache.catalina.startup.Catalina.start(Catalina.java:551)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
root cause
org.springframework.beans.NotWritablePropertyException: Invalid property 'usersdao' of bean class [com.loginsystem.service.impl.usersmanagerimpl]: Bean property 'usersdao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:793)
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:82)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
org.apache.catalina.startup.Catalina.start(Catalina.java:551)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
我的xml配置如下:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/fan"></property>
<property name="username" value="root"></property>
<property name="password" value="19861005"></property>
</bean>
<bean id="usersdao" class="com.loginsystem.dao.jdbc.usersdaoimpl">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
<bean id="usersmanager"
class="com.loginsystem.service.impl.usersmanagerimpl" abstract="false"
singleton="true" lazy-init="default" autowire="default"
dependency-check="default">
<property name="usersdao">
<ref bean="usersdao" />
</property>
</bean>
我在class usersmanagerimpl里面写的set方法
private usersdao dao;
public void setDao(usersdao usersdao) {
this.dao = usersdao;
}
哪位能帮我看看是什么问题呢?