2

I have created one spring batch project. It executes perfectly as Java application. After that I created a jar file using maven build. But when I tried to run the jar file, the below exception is thrown:

=================================================================================
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 142 in XML document from class path resource [SICBatchFile.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'job'.
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'job'.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    ... 14 more

=================================================================================

It's getting through the mail class. But when reading the xml, it throws this exception. Below is the xml part:

  <beans:beans 
        xmlns="ht tp: / /www.springframework.org/schema/batch" 
        xmlns:beans="ht tp: / /www.springframework.org/schema/beans" 
        xmlns:aop="ht tp: / /www.springframework.org/schema/aop"
        xmlns:tx="ht tp: / /www.springframework.org/schema/tx" xmlns:p="ht tp: / /www.springframework.org/schema/p"
        xmlns:xsi="ht tp :/ /www.w3.org/2001/XMLSchema-instance" xmlns:util="ht tp: / /www.springframework.org/schema/util"
        xsi:schemaLocation="ht tp: / /www.springframework.org/schema/beans  ht tp: / /www.springframework.org/schema/beans/spring-beans-2.0.xsd
        ht tp: / /www.springframework.org/schema/batch  ht tp: / /www.springframework.org/schema/batch/spring-batch-2.0.xsd
        ht tp: / /www.springframework.org/schema/aop  ht tp: / /www.springframework.org/schema/aop/spring-aop-2.0.xsd
        ht tp: / /www.springframework.org/schema/tx 
        ht tp: / /www.springframework.org/schema/tx/spring-tx-2.0.xsd">

     <job id="sicProcessorJob" job-repository="jobRepository">
        <step id="step1">
        <tasklet transaction-manager="jobRepository-transactionManager">
            <chunk reader="sicFileItemReader" processor="sicProcessor"
                writer="sicFileItemWriter" commit-interval="3">
        <streams>
            <stream ref="sicFileItemWriter1"/>
            <stream ref="sicFileItemWriter2" />
          </streams>
        </chunk>    
    </tasklet>
    </step>
    <listeners>
      <listener ref="jobListener" />
    </listeners>
  </job>

IDE: Eclipse

Leigh
  • 28,765
  • 10
  • 55
  • 103
Anand Kumar
  • 133
  • 2
  • 4
  • 10
  • See http://stackoverflow.com/questions/3650252/problem-starting-spring-application-from-java – axtavt May 02 '12 at 11:10

1 Answers1

0

After that I created a jar file using maven build. But when I tried to run the jar file

if you just created a simple jar file, then it can't work, the application needs all libraries (spring, commons, etc.)

you can

  • set the classpath or configure it with a manifest
  • use maven to create (see stackoverflow answer)
    • executable all-in-one.jar
    • directory structure with all you need including a .bat/.sh which sets the correct classpath
Community
  • 1
  • 1
Michael Pralow
  • 6,560
  • 2
  • 30
  • 46