Announcement Announcement Module
Collapse
No announcement yet.
Failed to read schema document Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Failed to read schema document

    Hi,

    I am having great difficulty in trying to run my spring batch application via the command line. It works fine when I run it within Spring Tool Suite but when I run it on the command line I get the error (see attachment for full stacktrace)

    Code:
    Failed to read schema document
    I have also create a new project called SampleBatch by importing the “Simple Spring Batch Project” template, copied this project into a folder on my C drive called C:\build\SampleBatch. navigated to this directory and run “mvn package” to create an executable jar and it runs fine with the command:

    Code:
    mvn exec:java -Dexec.mainClass=org.springframework.batch.core.launch.support.CommandLineJobRunner -Dexec.args="launch-context.xml job1 runid=1"
    However when I change to the target directory and run the following

    Code:
    java  -jar spring-batch-simple-2.0.0.CI-SNAPSHOT.jar launch-context.xml job1 runid=2
    I get the following error (see the attached output.txt for the full stacktrace).

    Code:
    org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-2.5.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
    I have coped the contents of the manifect.mf file of the jar spring-batch-simple-2.0.0.CI-SNAPSHOT.jar and all the libraries exist in the ./lib directory.

    Code:
    Manifest-Version: 1.0
    Archiver-Version: Plexus Archiver
    Created-By: Apache Maven
    Built-By: dwakley
    Build-Jdk: 1.6.0_20
    Main-Class: org.springframework.batch.core.launch.support.CommandLineJ
     obRunner
    Class-Path: lib/spring-jdbc-3.0.0.RELEASE.jar lib/spring-beans-3.0.0.R
     ELEASE.jar lib/spring-core-3.0.0.RELEASE.jar lib/spring-asm-3.0.0.REL
     EASE.jar lib/commons-logging-1.1.1.jar lib/spring-tx-3.0.0.RELEASE.ja
     r lib/aopalliance-1.0.jar lib/spring-aop-2.5.6.jar lib/spring-context
     -2.5.6.jar lib/spring-batch-core-2.1.0.RELEASE.jar lib/spring-batch-i
     nfrastructure-2.1.0.RELEASE.jar lib/xstream-1.3.jar lib/xpp3_min-1.1.
     4c.jar lib/jettison-1.1.jar lib/commons-dbcp-1.2.2.jar lib/commons-po
     ol-1.3.jar lib/commons-io-1.4.jar lib/hsqldb-1.8.0.7.jar lib/aspectjr
     t-1.6.8.jar lib/aspectjweaver-1.6.8.jar lib/log4j-1.2.14.jar lib/mysq
     l-connector-java-5.1.12.jar
    I have tried various suggestions I have found while researching this but to no avail.

    So would appreciate with further suggestions.
    Thanks in advance
    Dave
    Last edited by dwakley; Oct 2nd, 2010, 05:15 AM. Reason: Removed copy and paste error from the java -jar line

  • #2
    Switch off the JAR index feature when you build the JAR. Or don't use "java -jar ..." to launch a Spring application (you can see the background here: https://jira.springframework.org/browse/SPR-5705).

    Comment


    • #3
      Dave,

      Thanks for the advice that worked.

      You don't know how long i've spent researching this and trying different ways of building/running this.

      Thanks again
      Dave

      Comment

      Working...
      X