샘플 spring-cloud-dataflow 소스 애플리케이션을 실행하는 데 문제가 있습니다. 코드 0으로 응용 프로그램이 종료됩니다 (작동 중이어야합니다). 나는 그것을 디버깅하고 다음과 같은 예외가 발생되는 것을 발견 :Spring 클라우드 데이터 흐름 샘플 소스를 실행할 때 DestinationReslutionException이 발생했습니다.
DestinationResolutionException: failed to look up MessageChannel with name 'output'
내가 시작 설명서 http://docs.spring.io/spring-cloud-stream/docs/current/reference/htmlsingle/index.html#_getting_started을 follownig하고 있었고, 난 그것을 작동 얻을 수 없습니다. 내가 한 짓 : - 나는 사육사가 일하고있다. - 카프카가 있습니다.
코드 :
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)) {
}
}
}
와 치 :
<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을 = 시험
가내가 더 줄 수 예외에 대한 세부 정보 :
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[email protected]2ef14fe has been closed already
예, 이들은 동일한 패키지에 있습니다. 게다가 greet() 메서드에 중단 점을 추가하면 실행됩니다. 내가 밟은 및 메시지를 올바르게 준비하지만 추가 예외가 있습니다. DestinationResolutionException : '출력'이름으로 MessageChannel을 조회하지 못했습니다. 의사 소통에 문제가 있다고 가정합니까? – rideronthestorm
코드를 다시 보면, 메인 메소드에서'DisSampleSourceApplication'이란 무엇입니까? 나는 그것이 'SampleSourceApplication' 일 필요가 있다고 생각한다. –
예,이 질문에 코드를 복사 할 때 이것은 실수였다. 내 코드 클래스 이름 일치합니다. 결정된. – rideronthestorm