首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行示例源码时Spring cloud dataflow DestinationReslutionException

运行示例源码时Spring cloud dataflow DestinationReslutionException
EN

Stack Overflow用户
提问于 2016-12-09 23:01:12
回答 1查看 100关注 0票数 0

我在运行示例spring-cloud-dataflow源应用程序时遇到了问题。应用程序退出,返回代码0(并且它应该可以正常工作)。我对它进行了调试,注意到抛出了以下异常:

代码语言:javascript
复制
DestinationResolutionException: failed to look up MessageChannel with name 'output'

我一直在关注入门指南http://docs.spring.io/spring-cloud-stream/docs/current/reference/htmlsingle/index.html#_getting_started,但是我不能让它工作。我所做的:-我让动物园管理员工作;-我让卡夫卡工作;

代码:

代码语言:javascript
复制
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.integration.annotation.InboundChannelAdapter;

@EnableBinding(Source.class)
public class SampleSource {

    @InboundChannelAdapter(Source.OUTPUT)
    public String greet() {
        return "hello world " + System.currentTimeMillis();
    }
}

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SampleSourceApplication {

    public static void main(String[] args) {
        try (ConfigurableApplicationContext run = SpringApplication.run(SampleSourceApplication.class, args)) {
        }
    }
}

和pom:

代码语言:javascript
复制
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.4.2.RELEASE</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>  
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.SR3</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-stream-kafka</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

命令行参数:--spring.cloud.stream.bindings.output.destination=test

我可以提供有关该异常的更多详细信息:

代码语言:javascript
复制
org.springframework.messaging.core.DestinationResolutionException: failed to look up MessageChannel with name 'output' in the BeanFactory.; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.stream.messaging.Source': Initialization of bean failed; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration': Initialization of bean failed; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties': Initialization of bean failed; 
nested exception is java.lang.IllegalStateException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2ef14fe has been closed already
EN

回答 1

Stack Overflow用户

发布于 2016-12-12 11:51:45

看起来SampleSource类不是由主应用程序导入的。是否确定SampleSource类与SampleSourceApplication位于同一个包中

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41063227

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档