Announcement Announcement Module
Collapse
No announcement yet.
Invalid content was found starting with element 'tasklet' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Invalid content was found starting with element 'tasklet'

    Hi, I'm trying to upgrade my appliction from spring-batch 2.0 to 2.1, but I'm receiving the follow error:

    Code:
    11:32:21,050 ERROR JobClientExecutor:46 - Error to executing job.
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [bi-context.xml]
    Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [trackerETLJob.xml]
    Offending resource: class path resource [bi-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [trackerETLJob.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'tasklet'. One of '{"http://www.springframework.org/schema/batch":next, "http://www.springframework.org/schema/batch":stop, "http://www.springframework.org/schema/batch":end, "http://www.springframework.org/schema/batch":fail, "http://www.springframework.org/schema/batch":listeners}' is expected.
    	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:201)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
    	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
    	at br.com.pst.tracker.bi.client.JobClientExecutor.main(JobClientExecutor.java:29)
    Here my tasklet declaration:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/batch"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">
    	
    	<job id="vehiclesETL" job-repository="jobRepository">
     		
    		<step id="initMemDatabase">
    			<next on="*" to="monitStepsETL"/>
    			<next on="FAILED" to="failMemDatabase"/>
    			<tasklet ref="initMemDBTasklet"/>
    		</step>
    		 
    		<step id="monitStepsETL">
    			<next on="*" to="stopMemDatabase"/>
    			<next on="FAILED" to="failMemDatabase"/>
    			<tasklet transaction-manager="biTransactionManager">
    				<chunk reader="vehiclesReader" processor="vehicleMonitsProcessor" writer="vehicleMonitStepsWriter" commit-interval="1"/>
    			</tasklet>
    		</step>
    
    		<step id="stopMemDatabase">
    			<tasklet ref="stopMemDBTasklet"/>
    		</step>
    
    		<step id="failMemDatabase">
    			<fail on="*"/>
    			<tasklet ref="stopMemDBTasklet"/>
    		</step>
    </job>
    
    	<beans:bean id="initMemDBTasklet" class="br.com.pst.tracker.bi.tasklets.InitMemDBTasklet"/>
    	
    	<beans:bean id="stopMemDBTasklet" class="br.com.pst.tracker.bi.tasklets.StopMemDBTasklet"/>
    
    	<beans:bean id="vehiclesReader" scope="step" class="br.com.pst.tracker.bi.readers.VehicleReader"/>
    
    	<beans:bean id="vehicleMonitsProcessor" class="org.springframework.batch.item.support.CompositeItemProcessor">
    		<beans:property name="delegates">
    			<beans:list>
    				<beans:ref bean="vehicleLoadMonitsProcessor"/>
    				<beans:ref bean="vehicleMonitStepsProcessor"/>
    			</beans:list>
    		</beans:property>
    	</beans:bean>
    	
    	<beans:bean id="vehicleLoadMonitsProcessor" scope="step" class="br.com.pst.tracker.bi.processors.VehicleLoadMonitsProcessor">
    		<beans:property name="jobDate" value="#{jobParameters[scheduler.jobDate]}"/>
      	</beans:bean>
      	
      	<beans:bean id="vehicleMonitStepsProcessor" scope="step" class="br.com.pst.tracker.bi.processors.VehicleMonitStepsProcessor">
      		<beans:property name="jobDate" value="#{jobParameters[scheduler.jobDate]}"/>
      	</beans:bean>
      	
      	<beans:bean id="vehicleMonitStepsWriter" class="br.com.pst.tracker.bi.writers.VehicleMonitStepsWriter"/>
    
    </beans:beans>
    Thx for any help,
    Leandro Borges

  • #2
    The XML isn't strictly valid. It's just telling you to put your <tasklet/> declaration before your <next/>.

    Comment

    Working...
    X