已更新至camden发布问题

时间:2016-08-31 00:41:35

标签: spring-cloud spring-cloud-stream

我尝试从Brixton.SR5更新到Camden.M1。

我有使用consul和spring cloud stream运行的软件。我假设还需要一个额外的init步骤。

这是pom的一部分

  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.RELEASE</version>
    </parent>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Camden.M1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/libs-milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <properties>
        <java.version>1.8</java.version>

        <maven.javadoc.skip>true</maven.javadoc.skip>

        <lombok.version>1.14.8</lombok.version>

        <rpm-maven-plugin.version>2.1.2</rpm-maven-plugin.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.cisco.phisphere</groupId>
            <artifactId>servicesupport</artifactId>
            <version>1.0.0</version>
        </dependency>

        <!-- jolokia -->
        <dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zuul</artifactId>
        </dependency>


        <!--used for consul discovery-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-all</artifactId>
        </dependency>


        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-consul-config</artifactId>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.10</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth-stream</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>

        <!-- EXAMPLE FOR RABBIT BINDING -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
        </dependency>

        <!-- spectator metrics -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-spectator</artifactId>
        </dependency>

    </dependencies>


    <build>

        <finalName>routerservice</finalName>

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

            <!-- compiler plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>


            <!--  docker build plugin -->
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.3.9</version>
                <configuration>
                    <imageName>${project.build.finalName}</imageName>
                    <dockerDirectory>.</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>

        </plugins>

    </build>

这是启动时的异常跟踪。

016-08-30 20:24:13.177  INFO 24602 --- [           main] c.c.p.routerservice.RouterService        : No active profile set, falling back to default profiles: default
2016-08-30 20:24:16.211  INFO 24602 --- [           main] org.eclipse.jetty.util.log               : Logging initialized @6408ms
2016-08-30 20:24:16.308  INFO 24602 --- [           main] org.eclipse.jetty.server.Server          : jetty-9.3.11.v20160721
2016-08-30 20:24:16.428  INFO 24602 --- [           main] application                              : Initializing Spring embedded WebApplicationContext
2016-08-30 20:24:18.748  WARN 24602 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2016-08-30 20:24:18.749  INFO 24602 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-08-30 20:24:18.761  INFO 24602 --- [           main] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@7bc10d84
2016-08-30 20:24:19.527  INFO 24602 --- [           main] o.e.jetty.server.handler.ContextHandler  : Started o.s.b.c.e.j.JettyEmbeddedWebAppContext@3c0fae6c{/,file:///private/var/folders/8_/yq1cv_hs4jqd49v2zlzm8l9w0000gn/T/jetty-docbase.2269375622778918038.8765/,AVAILABLE}
2016-08-30 20:24:19.527  INFO 24602 --- [           main] org.eclipse.jetty.server.Server          : Started @9726ms
2016-08-30 20:24:21.043  INFO 24602 --- [           main] application                              : jolokia: No access restrictor found, access to any MBean is allowed
2016-08-30 20:24:26.427  WARN 24602 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2016-08-30 20:24:26.428  INFO 24602 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-08-30 20:24:27.734  INFO 24602 --- [           main] application                              : jolokia: No access restrictor found, access to any MBean is allowed
2016-08-30 20:24:27.745  INFO 24602 --- [           main] application                              : jolokia: jolokia:type=Config is already registered. Adding it with jolokia:type=Config,uuid=bf0dd481-342f-452a-9935-5fad3e90d10b, but you should revise your setup in order to either use a qualifier or ensure, that only a single agent gets registered (otherwise history functionality might not work)
2016-08-30 20:24:27.745  INFO 24602 --- [           main] application                              : jolokia: Cannot register (legacy) MBean handler for config store with name jmx4perl:type=Config since it already exists. This is the case if another agent has been already started within the same JVM. The registration is skipped.
2016-08-30 20:24:27.745  INFO 24602 --- [           main] application                              : jolokia: Jolokia Discovery MBean registration is skipped because there is already one registered.
2016-08-30 20:24:27.890  INFO 24602 --- [           main] o.e.jetty.server.handler.ContextHandler  : Stopped o.s.b.c.e.j.JettyEmbeddedWebAppContext@3c0fae6c{/,file:///private/var/folders/8_/yq1cv_hs4jqd49v2zlzm8l9w0000gn/T/jetty-docbase.2269375622778918038.8765/,UNAVAILABLE}
2016-08-30 20:24:27.917 ERROR 24602 --- [           main] o.s.boot.SpringApplication               : Application startup failed
org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: A default binder has been requested, but there is more than one binder available: rabbit,consul, and no default binder has been set.
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:874)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at com.cisco.phisphere.routerservice.RouterService.main(RouterService.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: java.lang.IllegalStateException: A default binder has been requested, but there is more than one binder available: rabbit,consul, and no default binder has been set.
    at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:116)
    at org.springframework.cloud.stream.binding.ChannelBindingService.getBinderForChannel(ChannelBindingService.java:142)
    at org.springframework.cloud.stream.binding.ChannelBindingService.bindProducer(ChannelBindingService.java:104)
    at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:206)
    at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:57)
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173)
    ... 21 common frames omitted

2 个答案:

答案 0 :(得分:3)

请勿使用consul-all启动器。将其更改为consul-discovery。所有入门者都带来了一个领事流。

答案 1 :(得分:1)

在您的情况下,您需要为兔子设置默认绑定器。

@Repository public interface UserDao extends CrudRepository<User,Long> { User findByUsername(String username); }