Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring XD集成测试失败,返回“0”;路径必须以/character";开头;_Java_Spring_Spring Xd - Fatal编程技术网

Java Spring XD集成测试失败,返回“0”;路径必须以/character";开头;

Java Spring XD集成测试失败,返回“0”;路径必须以/character";开头;,java,spring,spring-xd,Java,Spring,Spring Xd,我一直在寻找一种在SpringXD中正确测试自定义模块的方法,所以我一直在尝试模仿。但是,无论我如何配置他们的SingleNodeApplication,我仍然会得到以下错误: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobsController': Injection of autowired dependencies failed; nested excep

我一直在寻找一种在SpringXD中正确测试自定义模块的方法,所以我一直在尝试模仿。但是,无论我如何配置他们的
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$1.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$1.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$1.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$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.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$1.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$1.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$13(<generated>)
    at org.springframework.xd.dirt.server.admin.deployment.zk.DeploymentConfiguration$$EnhancerBySpringCGLIB$$bf8b0dd3$$FastClassBySpringCGLIB$$8c7055eb.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

问题是我的项目中没有必要的测试依赖项来运行
SingleNodeApplication
实例。通过将
springxd模块
插件添加到我们的

我们实际上并没有引入太多的SpringXD依赖项,因为我们将它部署为docker容器,并根据需要在Dockerfile中添加自定义模块

有一些插件冲突。
springxd模块
插件看起来像一个and,与普通的
springboot
插件(版本为1.4.1,在
springxd模块中为1.2.3)和
io.spring.dependency management
插件冲突。通过重新构造项目层次结构并将所有自定义XD模块放入它们自己的gradle子项目中,可以解决这个问题

@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"));
    }
}