加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

spring:no matching editors or conversion strategy found

(2017-03-29 23:00:06)

异常:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.
    at
    at
    at
    at
    at
    at
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.
    ... 25 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.
    ... 31 more
2017-3-29 22:44:09 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.
    at
    at
    at
    at
    at
    at
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.
    ... 25 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.
    ... 31 more

解决:将给事务管理器注入属性时,将引用ref错写成了value,导致出现如上异常,配置如下图:

http://imgsrc.baidu.com/forum/pic/item/2a84788b4710b912af75ab2acafdfc03904522c7.jpgmatching editors or conversion strategy found" TITLE="spring:no matching editors or conversion strategy found" />

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有