Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: job quits after 1st step after upgrade

  1. #1
    Join Date
    Jan 2009
    Posts
    10

    Default job quits after 1st step after upgrade

    Hi,

    My job consists of 3 steps, and worked fine with the 1.1.4 release. But after upgrading to RC1 of 2.0.0 the same job quits after the first step!

    What should I change?

    Code:
    <bean id="myjob" class="org.springframework.batch.core.job.SimpleJob">
    		<property name="name" value="myjob" />
    		<property name="steps">
    			<list>
    				<bean parent="tasklet1" />
    				<bean parent="tasklet1" />
    				<bean parent="tasklet1" />
    			</list>
    		</property>
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="restartable" value="true" />
    	</bean>

  2. #2
    Join Date
    Jan 2009
    Posts
    10

    Default update - still problems, now Attribute 'id' is not allowed to appear in element 'step

    I get a weird errormessage:
    Code:
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 33 in XML document from URL [file:/C:/Documents%20and%20Settings/u4x/workspace/springbatchtest/target/classes/jobber/eksempel.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'step'.
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
    	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:423)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    	at storebrand.linkbatch.BatchLauncher.start(BatchLauncher.java:114)
    	at storebrand.linkbatch.BatchLauncher.main(BatchLauncher.java:182)
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'step'.
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3185)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2680)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2094)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
    	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)
    	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
    	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
    	... 15 more
    xml-file:
    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.0.xsd ">
    
    
    	<beans:bean id="jobLauncher"
    		class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
    		<beans:property name="jobRepository" ref="jobRepository" />
    	</beans:bean>
    
    	<beans:bean id="dataSource" class="mycompany.DataSource" 
    		destroy-method="close">
    	</beans:bean>
    	
    	<beans:bean id="tm" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" >
    		<beans:property name="dataSource" ref="dataSource"></beans:property>
    	</beans:bean>
    
    	<beans:bean id="jobRepository"
    		class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
    		<beans:property name="transactionManager" ref="tm" />
    		<beans:property name="dataSource" ref="dataSource"/>
    		<beans:property name="databaseType" value="oracle"/>
    	</beans:bean>
      
      <beans:bean id="fooStep" class="mycompany.FooStep"></beans:bean>
      
      
        <job id="eksempel"  restartable="true">
          	<step id="step1" ref="fooStep" />
          	<step id="step2" ref="fooStep" />
    
        </job>
    
    </beans:beans>
    FooStep.java:
    Code:
    package mycompany;
    
    import org.springframework.batch.core.JobInterruptedException;
    import org.springframework.batch.core.Step;
    import org.springframework.batch.core.StepExecution;
    
    public class FooStep implements Step { 
    
    	public void execute(StepExecution arg0) throws JobInterruptedException {
    		System.out.println("FOOO -- executing");
    	}
    
    	public String getName() {
    		return "FooStepName";
    	}
    
    	public int getStartLimit() {
    		return Integer.MAX_VALUE;
    	}
    
    	public boolean isAllowStartIfComplete() {
    		return true;
    	}
    
    }

  3. #3
    Join Date
    Jun 2009
    Posts
    10

    Default Any solution - I got the same problem

    Hi,

    did you find a solution for your problem. It would be great if you could let me know as I'm facing the same problem. My job stops executing after the first step completed successfully ...

    Best regards
    Christian

  4. #4
    Join Date
    Jan 2009
    Posts
    10

    Default Upgrade fixed it

    Hi Christian,

    I didn't find a fix for this, but the error went away when I upgraded to a newer release candidate.

    -Nils

  5. #5
    Join Date
    Jun 2009
    Posts
    10

    Default

    Hi Nils,

    thank you for your reply !
    Which release are using ? I've tried SpringBatch 2.0.0 and SpringBatch 2.0.1.RELEASE. Both did not work properly :-(

    Christian

  6. #6
    Join Date
    Feb 2008
    Posts
    488

    Default

    Christian,

    Can you be more specific about the issue you're having?

  7. #7
    Join Date
    Jan 2009
    Posts
    10

    Default

    Quote Originally Posted by ckone72 View Post
    which release are using ?
    2.0.0.release

  8. #8
    Join Date
    Jun 2009
    Posts
    10

    Default

    HI,

    sure ;-)

    Previously we were using Spring batch 1.0.0. Now we're trying to migrate to version 2.0.0

    We have two jobs that have to be running. One job contains four steps. This worked fine on Spring Batch 1.0.0. But now on 2.0.0 the job quits execution after finishing the first step.
    The current configuration is as follows (I've shortened the XML a little bit to meet the max number of characters for this post. If you need more, please let me know. (Note: there is a fourth parameter for the jobRepository which wasn't required for version 1.0.0, but I've added this to satisfy the constructor method if version 2.0.0):

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    	<description>
    		This application context contains general bean definitions and
    		techarch related beans.
    	</description>
    <!-- <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate" />  -->
    
    	
    [...]
    	<!--  Batch Configuration -->
    
    	<bean id="fetchConfigData"
    		class="com.db.de.akk.batch.logic.FetchConfigData">
    		<property name="customerBaseDao">
    			<ref local="customerBaseDao" />
    		</property>
    	</bean>
    
    	<bean id="getCustomers"
    		class="com.db.de.akk.batch.logic.GetCustomers">
    		<property name="dataSource">
    			<ref local="crmCBDataSource" />
    		</property>
    		<property name="customerList">
    			<ref local="customerList" />
    		</property>
    		<property name="batchConfig">
    			<ref local="batchConfig" />
    		</property>
    	</bean>
    
    	<bean id="customerList"
    		class="com.db.de.akk.batch.pojo.CustomerListPojo" />
    
    	<bean id="batchConfig"
    		class="com.db.de.akk.batch.pojo.BatchConfigPojo" />
    
    	<bean id="batchConfigList"
    		class="com.db.de.akk.batch.pojo.BatchConfigListPojo" />
    
    	<bean id="getTreatments"
    		class="com.db.de.akk.batch.logic.GetTreatments">
    		<property name="getTreatmentPojo">
    			<ref local="getTreatmentPojo" />
    		</property>
    		<property name="customerList">
    			<ref local="customerList" />
    		</property>
    		<property name="batchConfig">
    			<ref local="batchConfig" />
    		</property>
    	</bean>
    
    	<bean id="writeCustTreat"
    		class="com.db.de.akk.batch.logic.WriteCustTreat">
    		<property name="customerList">
    			<ref local="customerList" />
    		</property>
    		<property name="customerBaseDao">
    			<ref local="customerBaseDao" />
    		</property>
    		<property name="batchConfig">
    			<ref local="batchConfig" />
    		</property>
    	</bean>
    
    	<bean id="deleteOutdatedTreatments"
    		class="com.db.de.akk.batch.logic.DeleteOutdatedTreatments">
    		<property name="customerBaseDao">
    			<ref local="customerBaseDao" />
    		</property>
    	</bean>
    	
    	<bean id="treatmentList" class="com.db.de.akk.batch.pojo.TreatmentListPojo"/>
    	
    	
    	<!--  Spring Batch configuration -->
    	
    	<bean id="batchController"
    		class="com.db.de.akk.batch.logic.BatchController" >
    		<property name="akkBatch">
    			<ref local="akkBatch"/>
    		</property>  
    			<property name="fcd">
    			<ref local="fetchConfigData"/>
    		</property> 
    		<property name="batchConfig">
    			<ref local="batchConfig" />
    		</property>
    	</bean>
    	
    	<bean id="akkBatch"
    		class="com.db.de.akk.batch.logic.AKKBatch">
    		<property name="jobLauncher" ref="jobLauncher" />
    		<property name="jobLocator" ref="jobRegistry" />
    	</bean>
    	
    	<bean id="akkBatchGenTreatments"
    		class="com.db.de.akk.batch.logic.AKKBatchGenTreatments">
    		<property name="jobLauncher" ref="jobLauncher" />
    		<property name="jobLocator" ref="jobRegistry" />
    	</bean>
    		
    	<bean id="akkBatchUsedTreatments"
    		class="com.db.de.akk.batch.logic.AKKBatchUsedTreatments">
    		<property name="jobLauncher" ref="jobLauncher" />
    		<property name="jobLocator" ref="jobRegistry" />
    	</bean>
    
    	<bean id="jobLauncher"
    		class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
    		<property name="jobRepository" ref="jobRepository" />
    	</bean>
    
    	<bean id="jobRepository"
    		class="org.springframework.batch.core.repository.support.SimpleJobRepository">
    		<constructor-arg ref="mapJobInstanceDao" />
    		<constructor-arg ref="mapJobExecutionDao" />
    		<constructor-arg ref="mapStepExecutionDao" />
    		<constructor-arg ref="mapExecutionContextDao" />
    	</bean>
    
    	<bean id="mapJobInstanceDao"
    		class="org.springframework.batch.core.repository.dao.MapJobInstanceDao" />
    
    	<bean id="mapJobExecutionDao"
    		class="org.springframework.batch.core.repository.dao.MapJobExecutionDao" />
    
    	<bean id="mapStepExecutionDao"
    		class="org.springframework.batch.core.repository.dao.MapStepExecutionDao" />
    	
    	<bean id="mapExecutionContextDao"
    		class="org.springframework.batch.core.repository.dao.MapExecutionContextDao" />	
    		
    		
    	<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
    
    	<bean id="jobRegistryBeanPostProcessor"
    		class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
    		<property name="jobRegistry" ref="jobRegistry" />
    	</bean>
    
    	<bean id="generateTreatmentsJob"
    		class="org.springframework.batch.core.job.SimpleJob">
    		<property name="steps">
    			<list>
    				<bean id="deleteOutdatedTreatmentsStep" parent="deleteOutdatedTreatments" />
    				<bean id="getCustomersStep" parent="getCustomers" />
    				<bean id="getTreatmentsStep" parent="getTreatments"/> 
    				<bean id="writeCustTreatStep" parent="writeCustTreat" />   			
    			</list>
    		</property>
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="restartable" value="true" />
    	</bean>
    
    	<bean id="getUsedTreatmentsJob"
    		class="org.springframework.batch.core.job.SimpleJob">
    		<property name="steps">
    			<list>
    				<!-- CK: changed parent="preparationBatch" to parent="preparationBatchIS" -->
    				<!-- CK: Due to new implementation we only need one step ! -->
    			    <bean id="preparationBatchStepIS" parent="preparationBatchIS" />  
    				<!-- <bean id="getUsedTreatmentsStep" parent="getUsedTreatments" /> -->
    				<!-- <bean id="writeUsedTreatStep" parent="writeUsedTreat" /> --> 
    				<!-- <bean id="deleteUsedTreatmentsStep" parent="deleteUsedTreatments" /> --> 		
    			</list>
    		</property>
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="restartable" value="true" />
    	</bean>
    	
    	<bean id="RTDSBatchJob"
    		class="org.springframework.batch.core.job.SimpleJob">
    		<property name="steps">
    			<list>
    				<bean id="preparationRTDSBatchStep" parent="preparationBatch" />		
    			</list>
    		</property>
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="restartable" value="true" />
    	</bean>
    	
    	<bean id="ISBatchJob"
    		class="org.springframework.batch.core.job.SimpleJob">
    		<property name="steps">
    			<list>
    			    <!-- CK: changed parent="preparationBatch" to parent="preparationBatchIS" -->
    				<bean id="preparationISBatchStep" parent="preparationBatchIS" />		
    			</list>
    		</property>
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="restartable" value="true" />
    	</bean>
    	
    	<!-- Quartz configuration -->
    	
    	<bean id="RTDSBatch" class="org.springframework.scheduling.quartz.JobDetailBean">
    		<property name="jobClass" value="com.db.de.akk.batch.logic.Batch" />
    		<property name="group" value="quartz-batch" />
    		<property name="jobDataAsMap">
    			<map>
    				<entry key="jobName" value="RTDSBatchJob"/>
    				<entry key="jobLocator" value-ref="jobRegistry"/>
    				<entry key="jobLauncher" value-ref="jobLauncher"/>
    			</map>
    		</property>
    	</bean>
    	
    	<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		<property name="triggers">
    			<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    				<property name="jobDetail" ref="RTDSBatch" />
    				<property name="cronExpression" value="0 00 07 * * ?" />
    			</bean>
    	</property>
    	</bean>
    	
    	
    	<bean id="ISBatch" class="org.springframework.scheduling.quartz.JobDetailBean">
    		<property name="jobClass" value="com.db.de.akk.batch.logic.Batch" />
    		<property name="group" value="quartz-batch" />
    		<property name="jobDataAsMap">
    			<map>
    				<entry key="jobName" value="ISBatchJob"/>
    				<entry key="jobLocator" value-ref="jobRegistry"/>
    				<entry key="jobLauncher" value-ref="jobLauncher"/>
    				<entry key="dataSource" value-ref="crmCBDataSource"/>
    				<entry key="batchConfig" value-ref="batchConfig" />
    				
    				<entry key="decisionController" value-ref="decisionController" />
    				<entry key="interactionService" value-ref="interactionService" />		
    				<entry key="akkBatch" value-ref="akkBatch"/>
    				<entry key="fcd" value-ref="fetchConfigData"/>
    				<entry key="rtProject">
    					<map>
    						<entry key="01">
    							<value>dbContactCCProject</value>
    						</entry>
    						<entry key="02">
    							<value>TrxMProject</value>
    						</entry>
    						<entry key="03">
    							<value>DanubeProject</value>
    						</entry>
    						<entry key="04">
    							<value>DanubeProject</value>
    						</entry>
    					</map>
    				</entry>
    				<entry key="decisionIDs">
    					<map>
    						<entry key="01">
    							<value>dbContactCC</value>
    						</entry>
    						<entry key="02">
    							<value>TrxM</value>
    						</entry>
    						<entry key="03">
    							<value>Danube</value>
    						</entry>
    						<entry key="04">
    							<value>Danube</value>
    						</entry>
    					</map>
    				</entry>
    			</map>
    		</property>
    	</bean>
      
      	
    	<bean id="scheduler2" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		<property name="triggers">
    			<bean id="cronTrigger2" class="org.springframework.scheduling.quartz.CronTriggerBean">
    				<property name="jobDetail" ref="ISBatch" />
    				<property name="cronExpression" value="0 00 06 ? * 1-7"/>
    			</bean>
    	</property>
    	</bean>
    	
    	
    
    </beans>
    Best Regards
    Christian
    Last edited by ckOne72; Jul 3rd, 2009 at 03:31 AM.

  9. #9
    Join Date
    Feb 2008
    Posts
    488

    Default

    Can you edit your post to use CODE tags. Also, is there a reason you're not using the new features of 2.0 such as the batch namespace and the JobRepositoryFactoryBean?

  10. #10
    Join Date
    Jun 2009
    Posts
    10

    Default

    Hi,

    as you see, I've edited my post using the CODE tags. Thank you for the hint !

    Well there's no special reason for not using the new features. My initial job was to "only" update the spring libraries including those for batch. And I tried to get this running before changing anything in more depth.

    If you've got a hint for me to get it running, that would really great !

    Best regards
    Christian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •