Announcement Announcement Module
Collapse
No announcement yet.
spring batch and quartz Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring batch and quartz

    Hi everybody,

    I would like tu use Quartz to launch a job using spring btach, I based my example on the sample that is provided in spring batch site, but I have an exception. I searched but didn't find anything on the Internet. The sample of Spring batch using Quartz seems quite complicated (uses maven that i don't know how to use). I want to use a main class to launch my batch but I have the following exception:

    Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultL istableBeanFactory.setSerializationId(Ljava/lang/StringV
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:128)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:465)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:395)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
    at quartzTest.Main.main(Main.java:13)


    Here's my Main class and my context file


    package quartzTest;
    import org.quartz.SchedulerException;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlAp plicationContext;

    public class Main {

    public static void main(String[] args) throws SchedulerException{
    ApplicationContext context= new ClassPathXmlApplicationContext("/Ressources/quartzLaunch-context.xml");

    System.out.println("ok");

    }
    }

    <?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"
    xmlns="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd">

    <bean id="transactionManager" class="org.springframework.batch.support.transacti on.ResourcelessTransactionManager" />

    <bean id="jobRepository" class="org.springframework.batch.core.repository.s upport.MapJobRepositoryFactoryBean"
    p:transactionManager-ref="transactionManager" />

    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail" ref="jobDetail" />
    <property name="cronExpression" value="0/10 * * * * ?" />
    </bean>
    </property>
    </bean>

    <batch:job id="helloJob" job-repository="jobRepository">
    <batch:step id="helloStep">
    <batch:tasklet ref="helloTasklet" transaction-manager="transactionManager"/>
    </batch:step>
    </batch:job>

    <bean id="helloTasklet" class="quartzTest.HelloTasklet" />

    <bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDe tailBean">
    <property name="jobClass" value="quartzTest.JobLauncherDetails" />
    <property name="group" value="quartz-batch" />
    <property name="jobDataAsMap">
    <map>
    <entry key="jobName" value="helloJob"/>
    <entry key="jobLocator" value-ref="jobRegistry"/>
    <entry key="jobLauncher" value-ref="jobLauncher"/>
    </map>
    </property>
    </bean>

    <bean id="jobRegistry" class="org.springframework.batch.core.configuratio n.support.MapJobRegistry" />

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

    </beans>


    Thank you for any help

  • #2
    java.lang.NoSuchMethodError usually points to a classpath problem. If you used Maven you wouldn't have to worry about it (so much).

    Comment


    • #3
      hi,

      thank you for your response, it's actually working right now ! as you said there was a problem in the buld path

      Comment

      Working...
      X