Announcement Announcement Module
Collapse
No announcement yet.
java.lang.IllegalStateException: A JobLauncher must be provided. Please add one to t Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.IllegalStateException: A JobLauncher must be provided. Please add one to t

    Hi,
    I am new to Spring and Spring Batch. While trying the examples of Spring Batch I am getting an error "A JobLauncher must be provided".

    Following are the configuration files:

    1. applicationContext.xml

    <?xml version="1.0" encoding="UTF-8"?>

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">


    <bean id="jobRepository" class="org.springframework.batch.core.repository.s upport.SimpleJobRepository">
    <constructor-arg>
    <bean class="org.springframework.batch.core.repository.d ao.MapJobInstanceDao"/>
    </constructor-arg>
    <constructor-arg>
    <bean class="org.springframework.batch.core.repository.d ao.MapJobExecutionDao" />
    </constructor-arg>
    <constructor-arg>
    <bean class="org.springframework.batch.core.repository.d ao.MapStepExecutionDao"/>
    </constructor-arg>
    <constructor-arg>
    <bean class="org.springframework.batch.core.repository.d ao.MapExecutionContextDao"/>
    </constructor-arg>

    </bean>

    <bean id="jobLauncher" class="org.springframework.batch.core.launch.suppo rt.SimpleJobLauncher">
    <property name="jobRepository" ref="jobRepository"/>
    </bean>

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@172.25.33.51:1521:GTPL" />
    <property name="username" value="centpoc" />
    <property name="password" value="centpoc" />
    </bean>

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



    <!-- <jdbc:initialize-database data-source="dataSource">
    <jdbc:script location="org/springframework/batch/core/schema-hsqldb.sql"/>
    </jdbc:initialize-database> -->

    </beans>



    2. SimpleJob.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <import resource="applicationContext.xml"/>

    <bean id="hello" class="com.example.PrintTasklet">
    <property name="message" value="Hello"/>
    </bean>

    <bean id="space" class="com.example.PrintTasklet">
    <property name="message" value=" "/>
    </bean>

    <bean id="world" class="com.example.PrintTasklet">
    <property name="message" value="World!"/>
    </bean>

    <bean id="taskletStep" abstract="true"
    class="org.springframework.batch.core.step.tasklet .TaskletStep">
    <property name="jobRepository" ref="jobRepository"/>
    <property name="transactionManager" ref="transactionManager"/>
    </bean>


    <bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJo b">
    <property name="name" value="simpleJob" />
    <property name="steps">
    <list>
    <bean parent="taskletStep">
    <property name="tasklet" ref="hello"/>
    </bean>
    <bean parent="taskletStep">
    <property name="tasklet" ref="space"/>
    </bean>
    <bean parent="taskletStep">
    <property name="tasklet" ref="world"/>
    </bean>
    </list>
    </property>
    <property name="jobRepository" ref="jobRepository"/>
    </bean>

    </beans>


    Need suggestions where I am going wrong.....
Working...
X