`
nesta13
  • 浏览: 116264 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

使用spring注入时出现NotWritablePropertyException

阅读更多

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookmarkManagerService' defined in file [E:\MyCode\bookmark\WebRoot\WEB-INF\classes\applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'bmUserDAO' of bean class [cn.onlysoft.bookmark.BookmarkManagerService]: Bean property 'bmUserDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'bmUserDAO' of bean class [cn.onlysoft.bookmark.BookmarkManagerService]: Bean property 'bmUserDAO' 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.setPropertyValue(BeanWrapperImpl.java:793)
 at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
 at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
 at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
 at org.springframework.context.support.FileSystemXmlApplicationContext.<init></init>(FileSystemXmlApplicationContext.java:93)
 at org.springframework.context.support.FileSystemXmlApplicationContext.<init></init>(FileSystemXmlApplicationContext.java:77)
 at org.springframework.context.support.FileSystemXmlApplicationContext.<init></init>(FileSystemXmlApplicationContext.java:67)
 at cn.onlysoft.bookmark.test.TestAddUser.testLoginUser(TestAddUser.java:35)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at junit.framework.TestCase.runTest(TestCase.java:154)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

原来是setter方法写错名称了。。。

同样的问题:

www.iteye.com/topic/103184

分享到:
评论
3 楼 a455642158 2012-09-21  
尼玛 我就根本没有写set方法……弄了半天啊。
2 楼 yuan_2004 2008-10-16  
如果是静态变量,自动生成的SETTER方法,把static关键字删除。
1 楼 projector 2008-06-27  
怎么写错名称了呢??????应该怎么写,,,我也碰到了这个问题。。。。

相关推荐

    Dubbo管理控制台(兼容JDK8)

    Dubbo管理控制台(兼容JDK8)

    spring常见错误

    总之,当在使用Spring框架时遇到错误,尤其是与配置相关的错误时,应仔细检查代码和配置文件,确保遵循所有必要的规范和最佳实践。对于依赖注入的问题,检查setter方法的正确性和参数类型匹配性;对于配置问题,确认...

    Spring入门十大问题

    - **NotWritablePropertyException**:当Spring容器尝试为Bean设置属性值,但该属性不存在或无法写入时抛出此异常。 - **常见原因**: - Bean类没有相应的setter方法。 - 属性名拼写错误。 - **解决方案**: - ...

    org.springframework.web.servlet-3.0.1.RELEASE-A.jar

    nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'error_view' of bean class [com.demo.controller.action.AuthorAction]: Bean property 'error_view' is not ...

    org.springframework.transaction-3.1.2.RELEASE.zip

    nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManagerBeanName' of bean class [org.springframework.transaction.interceptor....

    dubbo-admin 管理后台2.5.4 for JDK8

    大家可以直接使用 Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property ...

    SPRING API 2.0.CHM

    NotWritablePropertyException NullSafeComparator NullSourceExtractor NullValueInNestedPathException NumberUtils ObjectError ObjectFactory ObjectFactoryCreatingFactoryBean ObjectNameManager ...

    支持jdk8版本dubbo-admin

    org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType' is not writable ...

    dubbo_admin-2.54.war和dubbo_admin_2.54forJDK8

    org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType' is not writable ...

    Dubbo管理控制台dubbo admin2.X for jdk8 (window,liunx)

    如果是在JDK8下跑,会报错: org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean ...

    dubbo-admin-2.5.8.war(编译环境JDK8)

    org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType' is not writable or...

Global site tag (gtag.js) - Google Analytics