Spring XD 集成测试失败 "Path must start with / character"
Spring XD integration test fails with "Path must start with / character"
我一直在寻找一种方法来在 Spring XD 中正确测试我的自定义模块,所以我一直在尝试模仿 how Spring Xd itself tests spark processors。但是,无论我如何配置他们的SingleNodeApplication
,我都会继续收到以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobsController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.xd.dirt.server.admin.deployment.DeploymentMessagePublisher org.springframework.xd.dirt.rest.XDController.deploymentMessagePublisher; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentMessageProducer' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
at org.springframework.xd.dirt.server.singlenode.SingleNodeApplication.run(SingleNodeApplication.java:83)
at RakeExtractorSparkTest.setup(RakeExtractorSparkTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=12=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.xd.dirt.server.admin.deployment.DeploymentMessagePublisher org.springframework.xd.dirt.rest.XDController.deploymentMessagePublisher; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentMessageProducer' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 46 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentMessageProducer' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 48 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 60 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:368)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3.deploymentQueue(<generated>)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration.deploymentMessageProducer(DeploymentConfiguration.java:155)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3.CGLIB$deploymentMessageProducer(<generated>)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3$$FastClassBySpringCGLIB$c7055eb.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3.deploymentMessageProducer(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 61 more
Caused by: java.lang.IllegalArgumentException: Path must start with / character
at org.apache.curator.utils.PathUtils.validatePath(PathUtils.java:54)
at org.apache.curator.framework.recipes.queue.QueueBuilder.<init>(QueueBuilder.java:269)
at org.apache.curator.framework.recipes.queue.QueueBuilder.builder(QueueBuilder.java:64)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentQueue.start(DeploymentQueue.java:122)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentQueue.afterPropertiesSet(DeploymentQueue.java:153)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 80 more
我知道它无法自动装配 jobsController
,但它总是由于某些(zookeeper?)路径不是以 /
开头。我错过了一些明显的东西吗?作为参考,我的 @BeforeClass
方法导致一切失败:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration
public class RakeExtractorProcessorXdTest {
private static SingleNodeApplication application;
private static SingleNodeIntegrationTestSupport integrationSupport;
// This dies
@BeforeClass
public static void setUp() {
application = new SingleNodeApplication().run("--transport", "local");
integrationSupport = new SingleNodeIntegrationTestSupport(application);
integrationSupport.addModuleRegistry(new SingletonModuleRegistry(ModuleType.processor,
"rake-extractor"));
}
}
问题是我的项目中没有对 运行 SingleNodeApplication
实例的必要测试依赖项。通过将 spring-xd-module
插件添加到我们的 gradle builds 中解决了这个问题。
我们实际上并没有引入太多 Spring XD 依赖项,因为我们将其部署为 docker 容器,并根据需要在 Dockerfile 中添加自定义模块。
存在一些插件冲突。 spring-xd-module
插件看起来像 wrapper of Spring Boot and propdeps and uses old versions,并且与普通的旧 spring-boot
插件(版本 1.4.1,在 spring-xd-module
中是 1.2.3)和io.spring.dependency-management
插件。这是通过重组项目层次结构并将我们所有的自定义 XD 模块放入它们自己的 gradle 子项目中解决的。
我一直在寻找一种方法来在 Spring XD 中正确测试我的自定义模块,所以我一直在尝试模仿 how Spring Xd itself tests spark processors。但是,无论我如何配置他们的SingleNodeApplication
,我都会继续收到以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobsController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.xd.dirt.server.admin.deployment.DeploymentMessagePublisher org.springframework.xd.dirt.rest.XDController.deploymentMessagePublisher; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentMessageProducer' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
at org.springframework.xd.dirt.server.singlenode.SingleNodeApplication.run(SingleNodeApplication.java:83)
at RakeExtractorSparkTest.setup(RakeExtractorSparkTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=12=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.xd.dirt.server.admin.deployment.DeploymentMessagePublisher org.springframework.xd.dirt.rest.XDController.deploymentMessagePublisher; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentMessageProducer' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 46 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentMessageProducer' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 48 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.xd.dirt.server.admin.deployment.zk.ZKDeploymentMessagePublisher]: Factory method 'deploymentMessageProducer' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 60 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentQueue' defined in class org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Path must start with / character
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:368)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3.deploymentQueue(<generated>)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration.deploymentMessageProducer(DeploymentConfiguration.java:155)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3.CGLIB$deploymentMessageProducer(<generated>)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3$$FastClassBySpringCGLIB$c7055eb.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3.deploymentMessageProducer(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 61 more
Caused by: java.lang.IllegalArgumentException: Path must start with / character
at org.apache.curator.utils.PathUtils.validatePath(PathUtils.java:54)
at org.apache.curator.framework.recipes.queue.QueueBuilder.<init>(QueueBuilder.java:269)
at org.apache.curator.framework.recipes.queue.QueueBuilder.builder(QueueBuilder.java:64)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentQueue.start(DeploymentQueue.java:122)
at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentQueue.afterPropertiesSet(DeploymentQueue.java:153)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 80 more
我知道它无法自动装配 jobsController
,但它总是由于某些(zookeeper?)路径不是以 /
开头。我错过了一些明显的东西吗?作为参考,我的 @BeforeClass
方法导致一切失败:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration
public class RakeExtractorProcessorXdTest {
private static SingleNodeApplication application;
private static SingleNodeIntegrationTestSupport integrationSupport;
// This dies
@BeforeClass
public static void setUp() {
application = new SingleNodeApplication().run("--transport", "local");
integrationSupport = new SingleNodeIntegrationTestSupport(application);
integrationSupport.addModuleRegistry(new SingletonModuleRegistry(ModuleType.processor,
"rake-extractor"));
}
}
问题是我的项目中没有对 运行 SingleNodeApplication
实例的必要测试依赖项。通过将 spring-xd-module
插件添加到我们的 gradle builds 中解决了这个问题。
我们实际上并没有引入太多 Spring XD 依赖项,因为我们将其部署为 docker 容器,并根据需要在 Dockerfile 中添加自定义模块。
存在一些插件冲突。 spring-xd-module
插件看起来像 wrapper of Spring Boot and propdeps and uses old versions,并且与普通的旧 spring-boot
插件(版本 1.4.1,在 spring-xd-module
中是 1.2.3)和io.spring.dependency-management
插件。这是通过重组项目层次结构并将我们所有的自定义 XD 模块放入它们自己的 gradle 子项目中解决的。