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

spring xd Required module artifacts are either missing or invalid

我刚开始使用 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

模块上传成功'job:test_job'

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

成功创建并部署作业'test_elt'

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

我也尝试了一些不同的方法 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.apply(PathChildrenCache.java:509) [curator-recipes-2.6.0.jar:na]

the module jar file that I upload does not contain anything else just this file 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/...