Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]

后端 未结 5 1960
抹茶落季
抹茶落季 2020-11-30 03:16

Situation

I am using Spring Batch to build an Accumulative Snapshot for our Data Warehouse and I am having a configuration roadblock that I cannot figure out.

<
5条回答
  •  暖寄归人
    2020-11-30 04:03

    Run the job through CommandLineJobRunner: java -jar batchprimer-1.0.jar META-INF/spring/module-context.xml job1

    even with a complete target folder you have to provide the classpath information for the java command, to ease the configuration you can try it with an all-in-one executable jar e.g. with maven-shade-plugin or an executable shell script (.bat/.sh) with all needed libraries, e.g. with appassembler-maven-plugin

    maven-shade-plugin example configuration (creates additional jar):

    
                             
        maven-shade-plugin
        1.5
        
            
                package
                
                    shade
                
                
                    
                        
                            org.springframework.batch.core.launch.support.CommandLineJobRunner
                        
                        
                            META-INF/spring.handlers
                        
                        
                            META-INF/spring.schemas
                        
                    
                    true
                    
                    executable
                
            
        
    
    

    example appassembler configuration (creates subfolder structure and .bat/.sh):

    
        appassembler-maven-plugin
        org.codehaus.mojo
        1.1.1
        
            flat
            false
            ${project.build.directory}/appassembler
            
                512M
                1024M
                
                    -Dlog4j.configuration=../etc/log4j/log4j.properties
                
            
            etc
            
                
                    applicationName
                    org.springframework.batch.core.launch.support.CommandLineJobRunner
                    
                        spring/job-runner.xml
                        helloWorldJob
                        input.file.pattern=file:.../**/*.txt
                    
                    
                        booter-unix
                        booter-windows
                    
                
            
        
        
            
                package
                
                    generate-daemons
                    create-repository
                
            
        
    
    

提交回复
热议问题