Hi minella,
when i run it through commandline jobrunner.. no exception , no output but
when i run the same through class containg main method i am getting exception mentioned above
application context xml that i am importing applicationContextXml.txt
Here my class with main method
Code:
public class BatchLauncher {
public static Job job ;
public static JobLauncher jobLauncher;
public static JobRepository jobRepository;
public static String P_covStrDate = null;
/**
* @param args
*/
public static void main(String[] args) {
try {
AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("readXmlConfig.xml");
JobParametersBuilder builder = new JobParametersBuilder();
System.out.println("Entering.. main method of BatchLauncher ");
builder.addString("Date", "20/12/2012");
jobLauncher = (JobLauncher) applicationContext.getBean("jobLauncher");
jobRepository = (JobRepository) applicationContext.getBean("jobRepository");
job = (Job) applicationContext.getBean("xmlReadJob");
jobLauncher.run(job, builder.toJobParameters());
JobExecution jobExecution = jobRepository.getLastJobExecution(job.getName(), builder.toJobParameters());
System.out.println("Execution Status :: in main method of BatchLauncher "+jobExecution.toString());
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* Method to get CurrentDate
* @param String processDate
* @return
*/
private static java.sql.Date getCurrentDate(String covrStrdate) {
@SuppressWarnings("deprecation")
java.util.Date today = new java.util.Date(covrStrdate);
return new java.sql.Date(today.getTime());
}
public static Job getJob() {
return job;
}
public static void setJob(Job job) {
BatchLauncher.job = job;
}
public static JobLauncher getJobLauncher() {
return jobLauncher;
}
public static void setJobLauncher(JobLauncher jobLauncher) {
BatchLauncher.jobLauncher = jobLauncher;
}
public static JobRepository getJobRepository() {
return jobRepository;
}
public static void setJobRepository(JobRepository jobRepository) {
BatchLauncher.jobRepository = jobRepository;
}
}