0

I have a eclipse project, this run correctly in eclipse but when i export to executable jar dont work show the next exception:

 2015-11-10 15:30:35 INFO  DefaultListableBeanFactory:663 - Overriding bean definition for bean 'transactionManager': replacing [Generic bean: class [org.springframework.batch.support.transaction.ResourcelessTransactionManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [context.xml]] with [Generic bean: class [org.springframework.batch.support.transaction.ResourcelessTransactionManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [database.xml]]
 Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]
 Offending resource: class path resource [job.xml]

Unable to locate Spring NamespaceHandler for XML schema namespace http://www.springframework.org/schema/batch but this is only when the jar is compiled in eclipse works correctly.

This is my job.xml:

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:batch="http://www.springframework.org/schema/batch"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:context="http://www.springframework.org/schema/context"    
          xsi:schemaLocation="       
          http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        ">

    <import resource="context.xml" />
    <import resource="database.xml" />

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location"><value>application.properties</value></property>
    </bean>

    <bean id="irXmlRegenerate" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step">
        <property name="dataSource" ref="dataBaseSource" />
        <property name="sql">
            <value>
                SELECT * FROM Units
            </value>
        </property>
        <property name="rowMapper">
            <bean class="beans.UnitRowMapper" />
        </property>
    </bean>     

     <bean id="iwXmlRegenerate" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="step">
         <property name="resource" value="file:${Main.localDirectory}Regen\\#{jobParameters[RegenFileName]}" />
         <property name="marshaller" ref="UnitMarshaller" />
         <property name="rootTagName" value="UNITS" />
     </bean>     

     <bean id="UnitMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller">
         <property name="autodetectAnnotations" value="true"/>
     </bean>     

    <batch:job id="RegenTasks">
        <batch:step id="REGENERATE_FILE"> 
            <batch:tasklet>
                <batch:chunk reader="irXmlRegenerate" processor="ipXmlRviUnit" writer="iwXmlRegenerate" commit-interval="1" />
            </batch:tasklet>
        </batch:step>
    </batch:job>
 </beans>

i use < batch:job > instead < job > this is the problem? how i can use the tag job if when i remove it launch this exception:

 Line 615 in XML document from class path resource [job.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 615; columnNumber: 22; cvc-complex-type.2.4.a: Invalid content was found starting with element 'job'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"], "http://www.springframework.org/schema/beans":beans}' is expected.

0 Answers0