在spring xd

时间:2015-09-22 18:00:15

标签: spring spring-xd

我已创建自定义模块以读取流文件格式并写入rabbit mq

我在命令下面运行注册模块

module upload --type job --name messageca2 --file /Users/xyz/Downloads/spring-xd-1.2.1.RELEASE/xd/custom-modules/batch.jar

成功上传了模块'job:messageca2'

然后我想创造一份工作

job create --name messagerabbit2  --definition "messageca2 --makeUnique=false" --deploy 

它说 成功创建并部署了作业'messagerabbit2'

但是在日志控制台中,我看到以下错误如果我错过了某些内容请告诉我

group = 'messagerabbit2', sourceChannelName = [null], sinkChannelName = [null], index = 0, type = job, parameters = map['makeUnique' -> 'false'], children = list[[empty]]]
2015-09-22T12:48:15-0500 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:messageca2'.
    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]
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503) [curator-recipes-2.6.0.jar:na]
    at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92) [curator-framework-2.6.0.jar:na]
    at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:na]
    at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83) [curator-framework-2.6.0.jar:na]
    at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500) [curator-recipes-2.6.0.jar:na]
    at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35) [curator-recipes-2.6.0.jar:na]
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762) [curator-recipes-2.6.0.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
2015-09-22T12:48:15-0500 1.2.1.RELEASE INFO DeploymentsPathChildrenCache-0 container.DeploymentListener - Path cache event: path=/deployments/modules/allocated/9ceb7180-59b5-417b-a5fb-3dc546056bd3/messagerabbit2.job.messageca2.1, type=CHILD_REMOVED
2015-09-22T12:48:15-0500 1.2.1.RELEASE INFO DeploymentSupervisor-0 zk.ZKJobDeploymentHandler - Deployment status for job 'messagerabbit2': DeploymentStatus{state=failed,error(s)=java.lang.IllegalArgumentException: Required module artifacts are either missing or invalid. Unable to determine module type for module definition: 'job:messageca2'.
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.xd.module.core.ModuleFactory.createSimpleModule(ModuleFactory.java:122)
    at org.springframework.xd.module.core.ModuleFactory.createAndConfigureModuleInstance(ModuleFactory.java:98)
    at org.springframework.xd.module.core.ModuleFactory.createModule(ModuleFactory.java:81)

1 个答案:

答案 0 :(得分:1)

在使用/Users/xyz/Downloads/spring-xd-1.2.1.RELEASE/xd/custom-modules/命令上传模块之前,您不应该将模块放在module upload中,因为这实际上正是结束上传的地方。

因此,鉴于错误消息,我非常确定发生了什么,因为您正在阅读当前正在重新创建的文件,文件最终会被损坏!

所以,要么从其他地方上传,要么只是手动把它放在那里

  • 手动为其生成.md5哈希
  • 或完全禁用md5校验和的要求,如here
  • 所示