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

4

1 回答 1

0

之后,我使用 maven build 创建了一个 jar 文件。但是当我尝试运行 jar 文件时

如果你只是创建了一个简单的 jar 文件,那么它不能工作,应用程序需要所有库(spring、commons 等)

你可以

于 2012-05-03T13:05:52.590 回答