2016-12-05 93 views
0

我正在嘗試使用Kafka作爲代理來鍛鍊Spring Cloud Stream應用程序。 POM文件看起來像: -Spring Cloud Stream:ClassNotFoundException:org.springframework.integration.codec.kryo.KryoRegistrar

<properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <java.version>1.8</java.version> 
     <spring.boot.version>1.4.2.RELEASE</spring.boot.version> 
     <spring.cloud.version>Camden.SR3</spring.cloud.version> 
    </properties> 

    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <!-- Import dependency management from Spring Boot --> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-dependencies</artifactId> 
       <version>${spring.boot.version}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.springframework.cloud</groupId> 
       <artifactId>spring-cloud-dependencies</artifactId> 
       <version>${spring.cloud.version}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 



    <dependencies> 
     <dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-stream</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-integration</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.integration</groupId> 
      <artifactId>spring-integration-core</artifactId> 
     </dependency> 
     <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> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.5.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

主要類: -

@SpringBootApplication 
public class BootWebappApplication { 

    public static void main(String[] args) { 
     SpringApplication.run(BootWebappApplication.class, args); 
    } 
} 

試圖運行這個還給這樣的: -

Caused by: java.lang.ClassNotFoundException: org.springframework.integration.codec.kryo.KryoRegistrar 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 

我覺得依賴版本都搞砸了某個地方 - 我我在這個日期使用了最新版本。

什麼是使用正確的版本「spring.boot.version」 &「spring.cloud.version」如果這實際上是問題

回答

0

嘗試使用此

<dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-dependencies</artifactId> 
      <version>Brixton.SR5</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency> 
+0

,給了回來 - '項目構建錯誤:'dependencies.dependency.version'for org.springframework.cloud:spring-cloud-stream:jar丟失。' –

+0

它使用本地回購來檢查依賴關係,可能是它沒有下載新的罐子。你可以交叉檢查你的.m2回購。 –

+1

Brixton.SR5本身就是家長媽媽,它更喜歡孩子媽媽,春天雲流是孩子之一,它本身就是父親媽媽對兒童雲瓶子的數量。 (僅供參考),可能會給你任何想法找到完美的罐子。 –