使用路由器1.3.0

时间:2015-11-21 01:00:34

标签: spring-xd

我在1.3.0版本上遇到以下问题:

xd:> stream create test1 --definition' http | router --script =" file:/tmp/file1.groovy"' --deploy

这部署得很好。

xd:> stream create test2 --definition' http --port = 9999 | router --script =" file:/tmp/file2.groovy"' --deploy

以下是第二个流的日志跟踪:

  

2015-11-20T16:57:45-0800 1.3.0.RELEASE ERROR   DeploymentsPathChildrenCache-0 container.DeploymentListener -   异常部署模块   org.springframework.jmx.export.UnableToRegisterMBeanException:无法使用   注册MBean   带键的[org.springframework.integration.config.RouterFactoryBean#0]   ' org.springframework.integration.config.RouterFactoryBean#0&#39 ;;嵌套   异常是javax.management.InstanceAlreadyExistsException:   org.springframework.integration.router:名称= org.springframework.integration.config.RouterFactoryBean#0,类型= MethodInvokingRouter     在   org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:550)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.jmx.export.MBeanExporter.afterSingletonsInstantiated(MBeanExporter.java:432)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:792)   〜[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:835)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)   〜[spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at   org.springframework.boot.SpringApplication.run(SpringApplication.java:320)   〜[spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at   org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)   〜[spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at   org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:213)   〜[spring-xd-module-1.3.0.RELEASE.jar:1.3.0.RELEASE] at   org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217)   〜[spring-xd-dirt-1.3.0.RELEASE.jar:1.3.0.RELEASE] at   org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200)   〜[spring-xd-dirt-1.3.0.RELEASE.jar:1.3.0.RELEASE] at   org.springframework.xd.dirt.server.container.DeploymentListener.deployModule(DeploymentListener.java:365)   [spring-xd-dirt-1.3.0.RELEASE.jar:1.3.0.RELEASE] at   org.springframework.xd.dirt.server.container.DeploymentListener.deployStreamModule(DeploymentListener.java:334)   [spring-xd-dirt-1.3.0.RELEASE.jar:1.3.0.RELEASE] at   org.springframework.xd.dirt.server.container.DeploymentListener.onChildAdded(DeploymentListener.java:181)   [spring-xd-dirt-1.3.0.RELEASE.jar:1.3.0.RELEASE] at   org.springframework.xd.dirt.server.container.DeploymentListener.childEvent(DeploymentListener.java:149)   [spring-xd-dirt-1.3.0.RELEASE.jar:1.3.0.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_45] at   java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_45]     在   java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)   [na:1.8.0_45] at   java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_45]     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)   [na:1.8.0_45] at   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)   [na:1.8.0_45] at java.lang.Thread.run(Thread.java:745)[na:1.8.0_45]   引起:javax.management.InstanceAlreadyExistsException:   org.springframework.integration.router:名称= org.springframework.integration.config.RouterFactoryBean#0,类型= MethodInvokingRouter     at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)   〜[na:1.8.0_45] at   com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)   〜[na:1.8.0_45] at   com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)   〜[na:1.8.0_45] at   com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)   〜[na:1.8.0_45] at   com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)   〜[na:1.8.0_45] at   com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)   〜[na:1.8.0_45] at   org.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:195)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:678)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at   org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:615)   〜[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] ... 30常见   框架省略2015-11-20T16:57:45-0800 1.3.0.RELEASE INFO   DeploymentsPathChildrenCache-0 container.DeploymentListener - Path   缓存事件:   路径= /部署/模块/分配/ e38af683-03a1-4f46-abd9-abccb8aae1f3 / test2.sink.router.1,   type = CHILD_REMOVED 2015-11-20T16:57:45-0800 1.3.0.RELEASE INFO   DeploymentsPathChildrenCache-0 container.DeploymentListener -   取消部署模块[ModuleDescriptor @ 56110771 moduleName =' router',   moduleLabel =' router',group =' test2',sourceChannelName = [null],   sinkChannelName = [null],index = 1,type = sink,parameters =   地图['脚本' - >   '文件:/tmp/dirt/att-example/groovy/transfer.router.cps.groovy'],   children = list [[empty]]]

1 个答案:

答案 0 :(得分:1)

这是一个错误 - 请打开JIRA issue JIRA Issue here

除了禁用JMX之外,我还没有提出解决办法(到目前为止)。

由于某种原因,主弹簧MBean导出器正在尝试导出路由器;通常情况下,IntegrationMBeanExporter会禁用(如果存在)。

修改

这是一个解决方法......

创建此文件并将其放在xd/config

xd/config/META-INF/spring-xd/plugins/jmx/mbean-exporters.xml ...

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int-jmx="http://www.springframework.org/schema/integration/jmx"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/integration/jmx http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:mbean-export default-domain="xd.${xd.stream.name:${xd.job.name:}}" />

    <int-jmx:mbean-export object-naming-strategy="moduleObjectNamingStrategy" />

    <!-- TODO: Add BatchMbeanExporter -->
    <util:properties id="objectNameProperties">
        <prop key="group">${xd.group.name}</prop>
        <prop key="label">${xd.module.label}</prop>
        <prop key="type">${xd.module.type}</prop>
        <prop key="sequence">${xd.module.sequence}</prop>
    </util:properties>

    <bean id="moduleObjectNamingStrategy"
        class="org.springframework.xd.dirt.module.jmx.ModuleObjectNamingStrategy">
        <constructor-arg name="domain" value="xd.${xd.stream.name:${xd.job.name:}}" />
        <constructor-arg name="objectNameProperties" ref="objectNameProperties" />
    </bean>

</beans>

这将替换标准文件,并使流名称成为MBean域的一部分,因此MBean名称是唯一的。与标准文件的唯一区别是将default-domain添加到上下文mbean导出器。

我们仍然需要解决潜在的问题,即为什么普通的出口商没有抑制那个豆,但这应该让你去。