spring xd必需的模块工件丢失或无效

时间:2015-09-22 16:43:59

标签: hadoop spring-xd

我刚开始使用spring xd,想要测试一个我已经拥有的单节点配置的简单hadoop作业。我主要关注(http://docs.spring.io/spring-xd/docs/1.2.1.RELEASE/reference/html

我上传的模块jar文件不包含任何其他文件resources \ config \ spring-module.xml:

<!-- required since Hadoop Job is a class not an interface and we need to 
    use a Job with step scope to access #{jobParameters['...']} -->
<bean class="org.springframework.batch.core.scope.StepScope">
    <property name="proxyTargetClass" value="true" />
</bean>

<batch:job id="testetl">
    <batch:step id="testetl1">
        <batch:tasklet ref="testjob" />
    </batch:step>
</batch:job>

<hdp:jar-tasklet id="testjob"
    jar="/home/hduser/libs/abhishek.jar">

</hdp:jar-tasklet>

xd shell

xd:>module upload --type job --name test_job --file /home/hduser/springxd/test-job-module-0.0.1-SNAPSHOT.jar --force

成功上传了模块&#39; job:test_job&#39;

xd:>job create --name test_elt --definition "test_job" --deploy

成功创建并部署了作业&#39; test_elt&#39;

但是在服务器实例上遇到异常并且无法启动该作业。

我尝试了不同的xml但同样的错误。

不确定出了什么问题?

2015-09-22T21:49:24+0530 1.2.1.RELEASE INFO DeploymentsPathChildrenCache-0 container.DeploymentListener - Deploying module [ModuleDescriptor@1280cb40 moduleName = 'test_job', moduleLabel = 'test_job', group = 'test_elt', sourceChannelName = [null], sinkChannelName = [null], index = 0, type = job, parameters = map[[empty]], children = list[[empty]]]
2015-09-22T21:49:24+0530 1.2.1.RELEASE ERROR DeploymentsPathChildrenCache-0 container.DeploymentListener - **Exception deploying module
java.lang.IllegalArgumentException: Required module artifacts are either missing or invalid. Unable to determine module type for module definition**: 'job:test_job'.
at org.springframework.util.Assert.notNull(Assert.java:112) ~[spring-core-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.xd.module.core.ModuleFactory.createSimpleModule(ModuleFactory.java:122) ~[spring-xd-module-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.module.core.ModuleFactory.createAndConfigureModuleInstance(ModuleFactory.java:98) ~[spring-xd-module-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.module.core.ModuleFactory.createModule(ModuleFactory.java:81) ~[spring-xd-module-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.module.ModuleDeployer.createModule(ModuleDeployer.java:181) ~[spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.deployModule(DeploymentListener.java:363) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.deployJobModule(DeploymentListener.java:291) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.onChildAdded(DeploymentListener.java:181) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.childEvent(DeploymentListener.java:149) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509) [curator-recipes-2.6.0.jar:na]

1 个答案:

答案 0 :(得分:1)

  

我上传的模块jar文件不包含任何其他文件resources \ config \ spring-module.xml:

为了澄清,在生成的.jar文件中,xml文件必须位于

config\spring-module.xml

resources\config\spring-module.xml

(此resources位是规范maven位置的一部分,通常放置源文件,如src/main/resources

jar tvf your-module.jar应该阅读config/spring-module.xml resources/...