Hi,
I have a job under src/main/resources/META-INF/spring/batch/jobs. The job is from the SPIA book
I package my project to a War and deploy it on a Web Server (JBoss 4.2). Then I thought, that it should appear automatically in the jobs list (ie http://localhost:8081/springbatchadmin/jobs ). But nothing happens, no errors or so. After I call the job from a Java Class, then it shows in the Job List.
What can be wrong with my configuration and the Job doesn't appear in the Job List right after the deployment of the war ?
Many thanks for any answer in advance.
Andreas
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:batch="http://www.springframework.org/schema/batch" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd"> <job id="importProducts" xmlns="http://www.springframework.org/schema/batch"> <step id="decompress" next="readWriteProducts"> <tasklet ref="decompressTasklet" /> </step> <step id="readWriteProducts"> <tasklet> <chunk reader="reader" writer="writer" commit-interval="3" skip-limit="5"> <skippable-exception-classes> <include class="org.springframework.batch.item.file.FlatFileParseException" /> </skippable-exception-classes> </chunk> </tasklet> </step> </job> <bean id="decompressTasklet" class="com.axatech.batch.example.DecompressTasklet" scope="step"> <property name="inputResource" value="#{jobParameters['inputResource']}" /> <property name="targetDirectory" value="#{jobParameters['targetDirectory']}" /> <property name="targetFile" value="#{jobParameters['targetFile']}" /> </bean> <bean id="reader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step"> <property name="resource" value="file:#{jobParameters['targetDirectory']+jobParameters['targetFile']}" /> <property name="linesToSkip" value="1" /> <property name="lineMapper"> <bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"> <property name="lineTokenizer"> <bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"> <property name="names" value="PRODUCT_ID,NAME,DESCRIPTION,PRICE" /> </bean> </property> <property name="fieldSetMapper"> <bean class="com.axatech.batch.example.ProductFieldSetMapper" /> </property> </bean> </property> </bean> <bean id="writer" class="com.axatech.batch.example.ProductJdbcItemWriter"> <constructor-arg ref="dataSource" /> </bean> </beans>
WEB-INF\batch-infrastructure.xml
WEB-INF\applicationContext.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:batch="http://www.springframework.org/schema/batch" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd"> <batch:job-repository id="jobRepository" data-source="dataSource" transaction-manager="transactionManager"/> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository" /> </bean> <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" /> </beans>
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:annotation-config /> <import resource="batch-infrastructure.xml" /> <import resource="connect-database-context.xml" /> </beans>


Reply With Quote
