Reputation: 173
How to run the job within springbatchadmin.war from command line?
I used the following command in command prompt to run the job.
D:\apache-tomcat-6.0.35\webapps\springbatchadmin>java -classpath "lib\*;src" com.companyname.batch.BatchLauncher job1Cfg job1
But I got the error and I cannot run the job.
Please give me right directions.
Upvotes: 1
Views: 3788
Reputation: 542
If you are using tomcat for deploying the admin, then the .war file should have deployed itself into a folder as soon as you start the server once. Now you can trace to the location of the xml files inside that folder, and execute jobs from command-line.
eg: in my case, the xml files are in the folder,
tomcat\webapps\my_project_war\WEB-INF\classes\springbatch
So just in case you want to run a job (say 'abcJob'
) inside an xml, say 'xyz.xml'
,
use the command,
java org.springframework.batch.core.launch.support.CommandLineJobRunner "tomcat\webapps\my_project_war\WEB-INF\classes\springbatch\xyz.xml" "abcJob" parameter1=value1 etc
While running from command-line, you can also set the classpath variable to some constant location, so that you can run all relative jobs with reference to that location. (in my case it is'tomcat\webapps\my_project_war\WEB-INF\classes')
So I would use the command,
java org.springframework.batch.core.launch.support.CommandLineJobRunner "classpath*:springbatch/xyz.xml" "abcJob" parameter1=value1
Upvotes: 2