Announcement Announcement Module
Collapse
No announcement yet.
Error : 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

  • Error : no matching editors or conversion strategy found

    hi,I am getting error Error : no matching editors or conversion strategy found while executing multilinejob from spring batch sample code in my application environment.
    Note: Some of error code and xml D2D has been removed [dul to no. of char. previlages]
    Spring -2.5.2,Spring batch 1.0.0
    At console displayed following error
    Code:
    JobLauncher [email protected]db1d4
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'multilineOrderJob' defined in file [C:\work\epower\jobs\multilineOrderJob.xml]: Cannot create inner bean 'step1' of type [org.springframework.batch.core.step.item.SimpleStepFactoryBean] while setting bean property 'steps'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'step1' defined in file [C:\work\epowe
    ean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.springframework.batch.item.file.transform.Range[]] for property 'columns'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.springframework.batch.item.file.transform.Range] for property 'columns[0]': no matching editors or conversion strategy 
    found
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)
    	at Test.main(Test.java:35)
    And at logger
    Code:
    DEBUG] [] [main] org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:453) - Eagerly caching bean 'fixedFileDescriptor' to allow for resolving potential circular references
    [DEBUG] [] [main] org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:230) - Field [1-5] isn't an enum value
    java.lang.NoSuchFieldException: 1-5
    	at java.lang.Class.getField(Class.java:1507)
    	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:225)
    	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
    My job file is
    Code:
    	<?xml version="1.0" encoding="UTF-8"?> 	
    	<!--<import resource="classpath:/multilineOrderInputTokenizers.xml" />
    	<import resource="classpath:/multilineOrderIo.xml" />
    	
    	--><bean id="jobRegistryBeanPostProcessor"
    		class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
    		<property name="jobRegistry" ref="jobRegistry" />
    	</bean>
    	
    	<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
    	
    	<bean id="transactionManager" 
              class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource"/>
        </bean>	 
    	<bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJob" abstract="true">
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="restartable" value="true" />
    	</bean>
    	<bean id="taskletStep" class="org.springframework.batch.core.step.tasklet.TaskletStep" abstract="true">
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="allowStartIfComplete" value="true" />
    	</bean>
    	<bean id="simpleStep" class="org.springframework.batch.core.step.item.SimpleStepFactoryBean"
    		abstract="true">
    		<property name="transactionManager" ref="transactionManager" />
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="startLimit" value="100" />
    		<property name="commitInterval" value="1" />
    	</bean>
    	<bean id="mapJobInstanceDao" lazy-init="true"
    		class="org.springframework.batch.core.repository.dao.MapJobInstanceDao" />
    
    	<bean id="mapJobExecutionDao" lazy-init="true"
    		class="org.springframework.batch.core.repository.dao.MapJobExecutionDao" />
    
    	<bean id="mapStepExecutionDao" lazy-init="true"
    		class="org.springframework.batch.core.repository.dao.MapStepExecutionDao" />
    
    	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    		<property name="dataSource" ref="dataSource" />
    	</bean>
    	<bean id="skipLimitStep" class="org.springframework.batch.core.step.item.SkipLimitStepFactoryBean"
    		parent="simpleStep" abstract="true">
    		<property name="skipLimit" value="0" />
    	</bean>
    	<bean id="logAdvice" class="springapp.custom.ProcessorLogAdvice" />
    	
    	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="url" value="dbc:oracle:thin:@192.1.1.5:1521:APPWS2"/>
            <property name="username" value="dbcompare"/>
            <property name="password" value="dbcompare"/>
        </bean>
        <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
    		p:databaseType="oracle" p:dataSource-ref="dataSource" />
    	
        <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
    		<property name="jobRepository" ref="jobRepository" />
    	</bean>
    	<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
    		<property name="customEditors">
    			<map>
    				<entry key="int[]">
    					<bean class="org.springframework.batch.support.IntArrayPropertyEditor" />
    				</entry>
    				<entry key="org.springframework.batch.item.file.transform.Range[]">
    					<bean class="org.springframework.batch.item.file.transform.RangeArrayPropertyEditor" />
    				</entry>
    				<entry key="java.util.Date">
    					<bean class="org.springframework.beans.propertyeditors.CustomDateEditor">
    						<constructor-arg>
    							<bean class="java.text.SimpleDateFormat">
    								<constructor-arg value="yyyyMMdd" />
    							</bean>
    						</constructor-arg>
    						<constructor-arg value="false" />
    					</bean>
    				</entry>
    			</map>
    		</property>
    	</bean>
    	<bean id="multilineOrderJob" parent="simpleJob">
    		<property name="steps">
    			<bean id="step1" parent="simpleStep">
    				<property name="streams" ref="fileItemReader"/>
    				<property name="itemReader">
    					<bean
    						class="org.springframework.batch.item.support.AggregateItemReader">
    						<property name="itemReader"
    							ref="fileItemReader" />
    					</bean>
    				</property>
    				<property name="itemWriter">
    					<bean
    						class="org.springframework.batch.item.file.FlatFileItemWriter">
    						<property name="resource"
    							value="file:data/multilineStepOutput.csv" />
    							<property name="fieldSetCreator">
    								<bean class="org.springframework.batch.item.file.mapping.PassThroughFieldSetMapper"/>
    							</property>
    					</bean>
    				</property>
    			</bean>
    		</property>
    	</bean>
    	
    
    	<bean id="fileItemReader"
    		class="org.springframework.batch.item.file.FlatFileItemReader">
    		<property name="resource"
    			value="classpath:multilineStepInput.txt" />
    		<property name="lineTokenizer" ref="fixedFileDescriptor" />
    		<property name="fieldSetMapper" ref="tradeLineMapper" />
    		<!-- <property name="validator" ref="fixedValidator" /> -->
    	</bean>
    
    	<bean id="tradeLineMapper"
    		class="springapp.mapping.TradeFieldSetMapper" />
    
    	<bean id="fixedFileDescriptor"
    		class="org.springframework.batch.item.file.transform.PrefixMatchingCompositeLineTokenizer">
    		<property name="tokenizers">
    			<map>
    				<entry key="BEGIN" value-ref="beginRecordTokenizer" />
    				<entry key="END" value-ref="endRecordTokenizer" />
    				<entry key="" value-ref="tradeRecordTokenizer" />
    			</map>
    		</property>
    	</bean>
    
    	<bean id="beginRecordTokenizer"
    		class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
    		<property name="columns" value="1-5" />
    	</bean>
    
    	<bean id="endRecordTokenizer"
    		class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
    		<property name="columns" value="1-3" />
    	</bean>
    
    	<bean id="tradeRecordTokenizer"
    		class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
    		<property name="names" value="ISIN,Quantity,Price,Customer" />
    		<property name="columns" value="1-12, 13-15, 16-20, 21-29" />
    	</bean>
    </beans>
    My main class is
    Code:
    public class Test {
        static Logger logger = Logger.getLogger(Test.class);
    	public static void main(String[] args) throws SQLException, JobExecutionAlreadyRunningException, JobRestartException,		JobInstanceAlreadyCompleteException {
    		//final ApplicationContext  applicationContext = new ClassPathXmlApplicationContext("multilineOrderJob.xml");
    		//applicationContext.getAutowireCapableBeanFactory().autowireBeanProperties(null,AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
    		String strBeanFile="C:/work/epower/jobs/multilineOrderJob.xml";
    		XmlBeanFactory beanFactory = new XmlBeanFactory(new FileSystemResource(strBeanFile));
    		JobLauncher jobLauncher = (JobLauncher) beanFactory.getBean("jobLauncher");		
    		Job job = (Job) beanFactory.getBean("multilineOrderJob");
    		Map<String,String> map = new HashMap<String,String>();
            map.put("executiontime",new java.util.Date().toString());	         
            JobParameters parameters = new JobParameters(map, new HashMap<String,Long>(), new HashMap<String,Double>(), new HashMap<String,Date>());
            jobLauncher.run(job,parameters);	
    	}
    }
    Last edited by rajeshgajipara; Jan 16th, 2009, 12:32 AM.

  • #2
    not getting any solution. please help.

    Comment


    • #3
      Before digging much deeper, have you thought about upgrading? 1.0.0 is a very very old version of the framework. The latest in 1.x is 1.1.3, and 2.0 M4 should be out shortly.

      Comment


      • #4
        Did you get this resolved. I just came across this error in my codebase to make some changes. If you have not resolved this; jobOperator was missing in your config file.

        Comment


        • #5
          I had the similar problem today and got it resolved by ensuring that the bean depending on this reference (the problem bean) points to its interface and not implementation class

          Comment


          • #6
            I also got the same error. When I tried tp point it to interface class, it says cannot instantiate the bean cos it is interface.
            Please advice. Thanks.

            Comment


            • #7
              Can you post your snippet and context file along with the exception message?

              Comment


              • #8
                My application has only EJB project and no Web tier. am NOT using EJBs (Session beans) for Transaction Management. I want to use Spring POJO Declarative Transaction Management using AOP. Only entry point to the application is MDB.
                Since there is not web project, I am not sure how to load the application context xml where the transaction attributes are defined and let the container be aware of it.

                <bean id="sampleManager" class="test.SampleManager">
                <property name="dataAccessor" ref ="dataAccessor"/>
                <property name="dataSource">
                <ref local="dataSource"/>
                </property>
                </bean>

                <tx:advice id="txAdvice" transaction-manager="txManager">
                <tx:attributes>
                <tx:method name="get*" read-only="true"/>
                <tx:method name="*" propagation = "REQUIRED"/>
                </tx:attributes>
                </tx:advice>

                <aop:config>
                <aopointcut id="testOp" expression="execution(* test.SampleInterface.*(..))"/>
                <aop:advisor advice-ref="txAdvice" pointcut-ref="testOp"/>
                </aop:config>

                <bean id="txManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
                <property name="dataSource" ref="dataSource"/>
                </bean>
                </beans>

                SampleManager implements SampleInterface.

                For testing, i tried to load the xml using standalone java class main method
                applicationContext = new FileSystemXmlApplicationContext("beans.xml");

                I got the below exception

                Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sampleDelegate' defined in file [D:\Spring\DTM\DTM\beans.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateExcep tion; nested PropertyAccessExceptions (1) are:
                PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy0] to required type [test.SampleManager] for property 'sampleManager'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0] to required type [test.SampleManager] for property 'sampleManager': no matching editors or conversion strategy found
                Caused by: org.springframework.beans.PropertyBatchUpdateExcep tion; nested PropertyAccessException details (1) are:
                PropertyAccessException 1:
                org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy0] to required type [test.SampleManager] for property 'sampleManager'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0] to required type [test.SampleManager] for property 'sampleManager': no matching editors or conversion strategy found
                Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0] to required type [test.SampleManager] for property 'sampleManager': no matching editors or conversion strategy found


                Could you please advice? Thanks

                Comment


                • #9
                  Same problem here ....
                  No solutions to this ?

                  Comment


                  • #10
                    If SampleManager has an interface it will work out of the box. Otherwise you need to enable proxy-target-class in your tx config. please cross post in the Spring Framework Forum for more help (it's nothing to do with Batch).

                    Comment


                    • #11
                      Originally posted by Dave Syer View Post
                      If SampleManager has an interface it will work out of the box. Otherwise you need to enable proxy-target-class in your tx config. please cross post in the Spring Framework Forum for more help (it's nothing to do with Batch).
                      Confirmed.

                      Your class must implement an interface. I encountered the same issue when assigning a <util:map> with <String, MyCustomClass> to my service class. I've applied AOP but Spring keeps throwing a "no matching editors or conversions strategy found" exception.

                      It turns out my service class has a map property that doesn't use an interface. For example, Map<String, MyCustomClass>. I changed it to an interface: Map<String, ICustomClass>. (Of course you need to create the interface which is trivial).

                      Code:
                           <bean id="versionService" class="my.service.VersionService" 
                          	p:animalDAOMap-ref="animalDAOMap" />
                      
                      	<util:map id="animalDAOMap">
                      	    <entry key="dog" value-ref="dogDAO"/>
                                  <entry key="cat" value-ref="catDAO"/>
                                  <entry key="monkey" value-ref="monkeyDAO"/>
                      	</util:map>
                      On my VersionService, I have an animalDAOMap property declared as
                      Code:
                      private Map animalDAOMap<String, CustomDAO>
                      CustomDAO is not an interface! This works fine but when applying AOP, I get the error. Solution: You must convert the CustomDAO to an interface!

                      Comment

                      Working...
                      X