Reputation: 61
I am trying to run my job using SpringBatch-CommandLineJobRunner on Linux, I have the below jars in classpath. Can anyone please take a look and see If I am missing any jars and tell me the missing jars. In our project they dont want to use any tools like Maven or STS, we are just using eclipse, our jobs run well from eclipse. On Linux we get the below errors.. we are using below command
java -cp org.springframework.batch.core.launch.support.CommandLineJobRunner springbatch/config/applicationBatchContextPlan.xml crossRefAllPlansJob
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/batch/core/launch/support/CommandLineJobRunner
Jars in Classpath on linux :
springbatch/lib/aopalliance-1.0.jar
springbatch/lib/commons-collections-3.2.1.jar
springbatch/lib/commons-lang3-3.3.2.jar
springbatch/lib/commons-lang3-3.3.2-javadoc.jar
springbatch/lib/commons-logging-1.2.jar
springbatch/lib/javax.batch-api-1.0.jar
springbatch/lib/log4j-1.2.17.jar
springbatch/lib/ojdbc6.jar
springbatch/lib/spring-aop-4.1.7.RELEASE.jar
springbatch/lib/spring-aspects-4.1.7.RELEASE.jar
springbatch/lib/spring-batch-core-3.0.4.RELEASE.jar
springbatch/lib/spring-batch-infrastructure-3.0.4.RELEASE.jar
springbatch/lib/spring-beans-4.1.7.RELEASE.jar
springbatch/lib/spring-context-4.1.7.RELEASE.jar
springbatch/lib/spring-core-4.1.7.RELEASE.jar
springbatch/lib/spring-expression-4.1.7.RELEASE.jar
springbatch/lib/spring-jdbc-4.1.7.RELEASE.jar
springbatch/lib/spring-retry-1.1.2.RELEASE.jar
springbatch/lib/spring-tx-4.1.7.RELEASE.jar
Also, I want to know if there is any other way we can run spring batch jobs on linux without using the CommandLineJobRunner.
Upvotes: 1
Views: 1929
Reputation: 61
The problem is resolved since a couple of days. The jars in the classpath were not getting picked up properly.After a couple of retries, it did and its working as expected now
Thanks to everyone for helping.
Thanks Lakshmi
Upvotes: 0
Reputation: 17811
Based looking at this post and this post, you need to manually include all the jars on your classpath.
So basically:
java -cp ... org.springframework.batch.core.launch.support.CommandLineJobRunner springbatch/config/applicationBatchContextPlan.xml crossRefAllPlansJob
The first post has a handy shell script to help with this.
In terms of other deployment options, you can deploy a spring batch application anywhere you can deploy spring (e.g. servlet container). Generally though, if it is the principal thing going on in the app, a plain old jar is probably the simplest option.
Upvotes: 1