Results 1 to 5 of 5

Thread: CommandLineKJobRunner

  1. #1
    Join Date
    Apr 2008
    Posts
    174

    Default CommandLineKJobRunner

    I have the core jar file in my class path and am still getting following error when I type the following in command line:

    java CommandLineJobRunner

    Exception in thread "main" java.lang.NoClassDefFoundError: CommandLineJobRunner
    Caused by: java.lang.ClassNotFoundException: CommandLineJobRunner
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)

    Do I have to change the manifest file to have the main class information in the core jar?

    thanks!

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    The class name is org.springframework.batch.core.launch.support.Comm andLineJobRunner.

  3. #3
    Join Date
    Apr 2008
    Posts
    174

    Default

    How should I package my application as a jar file with all other jar files like core, infrastructure etc?

    I am using Eclipse to export them as a jar file and it asks me for a application entry point, which in this case wouldbe org.springframework.batch.core.launch.support.Comm anLineJobRunner rite? and that class is within a jar file and the utility does not allow me to specify that.

    Does anyone have experience of packaging your batch application? What is the proposed approach?

    thanks!

  4. #4
    Join Date
    Apr 2008
    Posts
    174

    Default

    Just wanted to add additional notes, I am wondering how you guys are running your job from command prompt, because even though CommandLineJobRunner has a main method in it, it is packed in a jar file whose manifest does not say which class is a main class.

    Also if I pack my application in a separate jar and have it in classpath along with spring-batch jars, would it find my job xml file (as the main class and job xml will reside in two different jars)

    This is the error I get when I just run the jar file:

    C:\spring-batch-1.0.0.FINAL\dist>java -jar spring-batch-core-1.0.0.FINAL.jar
    Failed to load Main-Class manifest attribute from
    spring-batch-core-1.0.0.FINAL.jar

  5. #5
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    We don't package our jars as executable, and we don't ship executable scripts. That's something you could do with your own packaging if you needed to. There's an Eclipse launcher in the samples project in SVN, and you can probably find references to using Maven to launch a job on the forum somewhere. There are simply too many different ways to set up the classpath, and we do not want to recommend any particular approach over another.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •