`
lgd_java2eye
  • 浏览: 189527 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

关于使用spring_batch2.1.8的sample的运行

阅读更多

问题一:在执行项目"spring-batch-parent"的时候出现下面的异常信息:
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE:bundlor (bundlor-transform) on project spring-batch-parent: Execution bundlor-transform of goal com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE:bundlor failed: Unable to load the mojo 'bundlor' in the plugin 'com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE'. A required class is missing: com/springsource/bundlor/support/classpath/ClassPathFactory
-----------------------------------------------------
realm =    plugin>com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/D:/maven-3.0.1/repository/com/springsource/bundlor/com.springsource.bundlor.maven/1.0.0.RELEASE/com.springsource.bundlor.maven-1.0.0.RELEASE.jar
urls[1] = file:/D:/maven-3.0.1/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[project>org.springframework.batch:spring-batch-parent:2.1.8.RELEASE, parent: ClassRealm[maven.api, parent: null]]]

-----------------------------------------------------

 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:451)
 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:188)
 at org.apache.maven.cli.MavenCli.main(MavenCli.java:134)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution bundlor-transform of goal com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE:bundlor failed: Unable to load the mojo 'bundlor' in the plugin 'com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE'. A required class is missing: com/springsource/bundlor/support/classpath/ClassPathFactory
-----------------------------------------------------
realm =    plugin>com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/D:/maven-3.0.1/repository/com/springsource/bundlor/com.springsource.bundlor.maven/1.0.0.RELEASE/com.springsource.bundlor.maven-1.0.0.RELEASE.jar
urls[1] = file:/D:/maven-3.0.1/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[project>org.springframework.batch:spring-batch-parent:2.1.8.RELEASE, parent: ClassRealm[maven.api, parent: null]]]

-----------------------------------------------------

 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
 ... 19 more
Caused by: org.apache.maven.plugin.PluginContainerException: Unable to load the mojo 'bundlor' in the plugin 'com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE'. A required class is missing: com/springsource/bundlor/support/classpath/ClassPathFactory
-----------------------------------------------------
realm =    plugin>com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/D:/maven-3.0.1/repository/com/springsource/bundlor/com.springsource.bundlor.maven/1.0.0.RELEASE/com.springsource.bundlor.maven-1.0.0.RELEASE.jar
urls[1] = file:/D:/maven-3.0.1/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[project>org.springframework.batch:spring-batch-parent:2.1.8.RELEASE, parent: ClassRealm[maven.api, parent: null]]]

-----------------------------------------------------

 at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:441)
 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:96)
 ... 20 more
Caused by: java.lang.NoClassDefFoundError: com/springsource/bundlor/support/classpath/ClassPathFactory
 at java.lang.Class.getDeclaredConstructors0(Native Method)
 at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
 at java.lang.Class.getDeclaredConstructors(Class.java:1808)
 at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243)
 at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96)
 at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:609)
 at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:816)
 at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:750)
 at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:235)
 at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:185)
 at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:824)
 at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:938)
 at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:971)
 at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:932)
 at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
 at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
 at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
 at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
 at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:995)
 at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
 at com.google.inject.Scopes$1$1.get(Scopes.java:59)
 at org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
 at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
 at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:247)
 at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
 at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:422)
 ... 21 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException


解决方法:
           就是把找到spring-batch-parent项目中的pom.xml文件,然后把下面的


   <plugin>
    <groupId>com.springsource.bundlor</groupId>
    <artifactId>com.springsource.bundlor.maven</artifactId>
    <version>${bundlor.version}</version>
    <inherited>true</inherited>
    <executions>
     <execution>
      <id>bundlor-transform</id>
      <phase>compile</phase>
      <goals>
       <goal>bundlor</goal>
      </goals>
     </execution>
    </executions>
   </plugin>
就是把上面的红色字体的部分改成<phase>runtime</phase> 即可解决问题

问题2:在项目"spring-batch-simple-cli"打包的时候出现下面的异常信息

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project spring-batch-simple-cli: Error assembling JAR: Manifest file: D:\citic\spring_batch\spring-batch-2.1.8.RELEASE\samples\spring-batch-simple-cli\target\classes\META-INF\MANIFEST.MF does not exist. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project spring-batch-simple-cli: Error assembling JAR
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:203)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:451)
 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:188)
 at org.apache.maven.cli.MavenCli.main(MavenCli.java:134)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR
 at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:223)
 at org.apache.maven.plugin.jar.AbstractJarMojo.execute(AbstractJarMojo.java:235)
 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
 ... 19 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: Manifest file: D:\citic\spring_batch\spring-batch-2.1.8.RELEASE\samples\spring-batch-simple-cli\target\classes\META-INF\MANIFEST.MF does not exist.
 at org.codehaus.plexus.archiver.jar.JarArchiver.setManifest(JarArchiver.java:211)
 at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:510)
 at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:216)
 ... 22 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

解决方法如下:

需要找到改项目"spring-batch-simple-cli"中的pom.xml配置文件找到下面的配置代码进行更改:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
     <archive>
      <index>false</index>
      <manifest>
       <mainClass>org.springframework.batch.core.launch.support.CommandLineJobRunner</mainClass>
       <addClasspath>true</addClasspath>
       <classpathPrefix>lib/</classpathPrefix>
      </manifest>
      <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
     </archive>
    </configuration>
   </plugin>

 需要更改红色的部分,把<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>更改为下面的内容

<manifestFile>${project.build.outputDirectory}/META-INF/template.mf</manifestFile>

然后把项目中的template.mf的文件copy到该项目中的"src/main/resources/META-INF"的目录下面即可
然后进行package就不会再出现下面的问题。

问题3:在项目"spring-batch-simple"打包的时候出现和问题2中出现的一样的异常

解决方法:
打开项目"spring-batch-parent"的项目,然后打开pom.xml配置文件

    <plugin>
     <artifactId>maven-jar-plugin</artifactId>
     <version>2.3</version>
     <configuration>
      <archive>
       <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
      </archive>
     </configuration>
    </plugin>

  然后把上面的红色的部分更改为下面的内容:
       <manifestFile>${project.build.outputDirectory}/META-INF/template.mf</manifestFile>即可

然后打开项目"spring-batch-samples",把该项目中的"template.mf"的文件copy到该项目的src/main/resources下面的META-INF的目录下面
然后使用maven的package即可

 

若还有其他的问题则在改pom中加入如下的代码:

 

 

<repositories>
  <repository>
   <id>com.springsource.repository.bundles.external</id>
   <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle External</name>
   <url>http://repository.springsource.com/maven/bundles/external</url>
   <snapshots>
    <enabled>false</enabled>
   </snapshots>
  </repository>
  <repository>
   <id>com.springsource.repository.bundles.snapshot</id>
   <name>SpringSource Enterprise Bundle Repository -
    SpringSource Bundle Snapshots</name>
   <url>http://repository.springsource.com/maven/bundles/snapshot</url>
  </repository>
  <repository>
   <id>com.springsource.repository.bundles.milestone</id>
   <name>SpringSource Enterprise Bundle Repository -
    SpringSource Bundle Milestones</name>
   <url>http://repository.springsource.com/maven/bundles/milestone</url>
   <snapshots>
    <enabled>false</enabled>
   </snapshots>
  </repository>
  <repository>
   <id>com.springsource.repository.bundles.release</id>
   <name>SpringSource Enterprise Bundle Repository -
    SpringSource Bundle Releases</name>
   <url>http://repository.springsource.com/maven/bundles/release</url>
   <snapshots>
    <enabled>false</enabled>
   </snapshots>
  </repository>
    <repository>
        <id>springsource-releases</id>
        <name>SpringSource Release Proxy</name>
        <url>https://oss.sonatype.org/content/repositories/springsource-releases</url>
      </repository>
  
 </repositories>

1
0
分享到:
评论

相关推荐

    Spring_Batch系列文章汇总

    从给定文件内容中,我们可以提炼出关于Spring_Batch的系列知识点,具体如下: Spring_Batch是一个轻量级的、面向Spring框架的批处理框架,它的核心目标是为企业级系统提供高性能的数据处理能力。它支持大量数据的...

    spring batch 2.1.8版本

    ### Spring Batch 2.1.8 版本详解 #### 一、Spring Batch 简介 ##### 1.1 背景介绍 Spring Batch 是一个强大的批量处理框架,旨在简化开发大型批量数据处理应用的过程。该框架提供了一种灵活且可扩展的方式来构建...

    springboot-batch-master.zip_hallu91_spring_springbatch_springboo

    【标题】"springboot-batch-master.zip_hallu91_spring_springbatch_springboo" 暗示这是一个关于Spring Boot集成Spring Batch的项目示例。Spring Batch是Spring框架的一部分,专门用于处理批量处理任务,而Spring ...

    Spring_Batch_Reference开发参考文档.pdf

    Spring Batch为Spring生态圈中一个轻量级...是使用Java语言基于Spring框架为基础开发的。 Spring Batch提供了大量可以即开即用的组件。对于大数据量和高性能的批量处理任务也提供了包括分区功能、远程功能等解决方案。

    data_batch_5_data_batch5_cifar10_data_batch_0_batch_

    cifar-10数据集由10个类的60000个32x32彩色图像组成,每个类有6000个图像。有50000个训练图像和10000个测试图像。数据集分为五个训练批次和一个...具体:batch5.mat文件,该训练集可以用于图片识别,非负矩阵分解等。

    SpringBatch-DataMigration SpringBatch数据迁移项目

    1.本项目运行在tomcat容器中,主要功能为从spring_batch_left库的user_from表抓取数据,之后批量插入到spring_batch_right库的user_to表 2.应用quartz对job进行定时触发(目前设置的定时为每隔一分钟执行一次,目前...

    test_batch_test_batch_cifar10_batch_

    cifar-10数据集由10个类的60000个32x32彩色图像组成,每个类有6000个图像。有50000个训练图像和10000个测试图像。数据集分为五个训练批次和一个测试批次,每个批次有10000个图像。测试批次包含来自每个类别的恰好...

    spring_batch.zip

    spring boot整合mybatis plus 集成 starter多数据源 数据源加载在基于DataProperteis的基础上配置了 master slave, 将它们配置成map,map中是多个数据源的主键和数据源属性的映射; 因此, 再通过线程隔离 ...

    tensorflow中next_batch的具体使用

    本文介绍了tensorflow中next_batch的具体使用,分享给大家,具体如下: 此处给出了几种不同的next_batch方法,该文章只是做出代码片段的解释,以备以后查看: def next_batch(self, batch_size, fake_data=False)...

    使用spring batch需要在数据库建立的几个表——建表语句

    使用spring batch需要在数据库建立的几个表——建表语句(BATCH_JOB_INSTANCE、BATCH_JOB_EXECUTION、BATCH_JOB_EXECUTION_CONTEXT、`BATCH_JOB_EXECUTION_PARAMS` 、`BATCH_JOB_EXECUTION_SEQ` 、`BATCH_JOB_SEQ` ...

    Mosaic_Batch.rar_ mosaic_batch_Mosaic_batch.rar_batch_envi图像镶嵌_图

    ENVI IDL编程 图像镶嵌批处理 图像镶嵌批处理

    spring-batch-reference.rar_SpringBatch英文读物pdf_batch

    9. **作业调度(Job Scheduling)**:Spring Batch 可以与Spring Integration或Quartz等调度框架集成,实现定时或触发事件时自动运行作业。 10. **监控和管理(Monitoring and Management)**:Spring Batch 提供了...

    Spring Batch 2.1.8

    - **Item**:Spring Batch 使用“Item”作为数据的基本单位,可以是数据库记录、文件行等。 - **Reader**:读取器(ItemReader)负责从数据源获取Item。 - **Processor**:处理器(ItemProcessor)对每个Item进行...

    envi_batch_template.rar_Envi 批处理_batch_envi_envi_batch_template_

    总结一下,这个“envi_batch_template.rar”文件包含了一个使用IDL编写的ENVI批处理模板,该模板用于在idl环境下处理海量遥感数据。用户可以通过修改“envi_batch_template.pro”文件来定义自己的图像处理流程,实现...

    Spring Boot整合Spring Batch,实现批处理

    在Java开发领域,Spring Boot和Spring Batch的整合是构建高效...通过学习和实践这个示例,你不仅可以掌握如何在Spring Boot中使用Spring Batch,还能了解批处理的最佳实践,这对于处理大数据量的应用场景非常有价值。

    Spring_Dev_Guide

    Spring Framework是Java平台上广泛使用的开源框架,它为构建高质量、可维护的Java应用程序提供了全面的支持。本指南旨在深入探讨Spring框架的核心特性及其在实际开发中的应用,帮助开发者充分利用Spring的强大功能。...

    data_batch_3_data_batch_3_batch_

    cifar-10数据集由10个类的60000个32x32彩色图像组成,每个类有6000个图像。有50000个训练图像和10000个测试图像。数据集分为五个训练批次和一个...具体:batch3.mat文件,该训练集可以用于图片识别,非负矩阵分解等。

    envi_batch_template.rar_batch_envi_envi_batch_template_envi单波段_批

    这表明该压缩包内容是关于使用ENVI软件进行批量处理单波段遥感图像的模板。 ENVI是一款强大的遥感图像处理和分析软件,广泛应用于地球科学、环境监测、地质勘探等领域。它提供了丰富的图像处理工具和算法,包括图像...

    data_batch_4_data_batch_4_batch_cifar10_

    cifar-10数据集由10个类的60000个32x32彩色图像组成,每个类有6000个图像。有50000个训练图像和10000个测试图像。数据集分为五个训练批次和一个...具体:batch4.mat文件,该训练集可以用于图片识别,非负矩阵分解等。

    SpringBatch+Spring+Mybatis+MySql (spring batch 使用jar)

    Spring Batch是一个轻量级的,完全面向Spring的批处理框架,可以应用于企业级大量的数据处理系统。Spring Batch以POJO和大家熟知的Spring框架为基础,使开发者更容易的访问和利用企业级服务。Spring Batch可以提供...

Global site tag (gtag.js) - Google Analytics