Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.0.5 configuration issue - no matching editors or conversion strategy found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.0.5 configuration issue - no matching editors or conversion strategy found

    Hi,

    I have just upgraded to new Spring 3.0.5. Replaced all spring named jars.
    With version 2.5 i was able to do the following exception:

    Bean:
    Code:
    public class HomeDirSetter implements BeanFactoryPostProcessor {
        private ServletContextResource homeDir;
    
        public void postProcessBeanFactory(ConfigurableListableBeanFactory factory) throws BeansException {
            try {
                if (homeDir != null && homeDir.exists()) {
                    File file = homeDir.getFile();
                    if(file!=null){
                    FileHelper.initializeHomeDir(file.getAbsolutePath());
                        return;
                    }
                } else {
                    FileHelper.initializeHomeDir();
                }
            } catch (Exception e) {                                   
                throw new RuntimeException(e);
            }
    
    
        }
    
        public void setHomeDir(ServletContextResource homeDir) {
            this.homeDir = homeDir;
        }
    }
    Bean definition:

    Code:
     <bean class="com.rf.common.framework.spring.HomeDirSetter">
            <property name="homeDir" value="."/>
        </bean>

    After the upgrade I no longer can do that. I get the following exception:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'com.rf.common.framework.spring.HomeDirSetter#0' defined in ServletContext resource [/WEB-INF/classes/conf/spring/Webbased-Context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.web.context.support.ServletCo ntextResource' for property 'homeDir'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.web.context.support.ServletCon textResource] for property 'homeDir': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:527)
    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 91)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:1079)
    at org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:651)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:407)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3934)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4429)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:526)
    at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:630)
    at org.apache.catalina.startup.HostConfig.deployDescr iptors(HostConfig.java:556)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:491)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1206)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:314)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:583)
    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.catalina.startup.Bootstrap.start(Bootst rap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)
    Caused by: org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.web.context.support.ServletCo ntextResource' for property 'homeDir'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.web.context.support.ServletCon textResource] for property 'homeDir': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertI fNecessary(BeanWrapperImpl.java:462)
    at org.springframework.beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:499)
    at org.springframework.beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:493)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.convertForProperty(Abst ractAutowireCapableBeanFactory.java:1371)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1330)
    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)
    ... 35 more


    Please help

    Thanks

    Martin
Working...
X