0

サンプル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 

答えて

0

クラスSampleSourceはメインアプリケーションによってインポートされていないようです。 SampleSourceクラスはSampleSourceApplicationと同じパッケージに入っていますか?

+0

はい、同じパッケージに含まれています。さらに、greet()メソッドにブレークポイントを追加して実行します。私はステップインし、メッセージは正しく準備されていますが、さらに例外があります。DestinationResolutionException:MessageChannelを名前 'output'でルックアップするのに失敗しました。コミュニケーションに問題があると私は想定していますか? – rideronthestorm

+0

あなたのコードをもう一度見て、メインメソッドで 'DisSampleSourceApplication'とは何ですか?私はそれが 'SampleSourceApplication'である必要があると思います。 –

+0

はい、これは、この質問にコードをコピーする際に間違いでした。私のコードクラス名は一致します。一定。 – rideronthestorm

関連する問題