2016-12-05 125 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本身就是家长妈妈,它更喜欢孩子妈妈,春天云流是孩子之一,它本身就是父亲妈妈对儿童云瓶子的数量。 (仅供参考),可能会给你任何想法找到完美的罐子。 –