我正在尝试运行春季云任务 rabbitmq,但我收到如下错误:
. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.4.RELEASE)
2018-08-14 16:54:53.674 INFO 6676 --- [ main] lsightSpringcloudM3TaskintakeApplication : Starting PluralsightSpringcloudM3TaskintakeApplication on P2BLAP-FG4DVP2 with PID 6676 (pluralsight-springcloud-m3-taskintaketargetclasses started by .. in C.. /pluralsight-springcloud-m3-taskintake)
2018-08-14 16:54:53.681 INFO 6676 --- [ main] lsightSpringcloudM3TaskintakeApplication : No active profile set, falling back to default profiles: default
2018-08-14 16:54:53.745 INFO 6676 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6ae5aa72: startup date [Tue Aug 14 16:54:53 IST 2018]; root of context hierarchy
2018-08-14 16:54:54.405 INFO 6676 --- [ main] o.s.i.config.IntegrationRegistrar : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2018-08-14 16:54:54.421 INFO 6676 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'taskProcessor' with a different definition: replacing [Generic bean: class [pluralsight.demo.TaskProcessor]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [C:Usersprabin.tripathiSTSsts-bundleprojectspluralsight-springcloud-m3-taskintaketargetclassespluralsightdemoTaskProcessor.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=taskConfig; factoryMethodName=taskProcessor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [pluralsight/demo/TaskConfig.class]]
2018-08-14 16:54:54.835 INFO 6676 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2018-08-14 16:54:54.837 INFO 6676 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2018-08-14 16:54:54.980 INFO 6676 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration' of type [org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration$$EnhancerBySpringCGLIB$$45205f62] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-08-14 16:54:55.073 INFO 6676 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration$$EnhancerBySpringCGLIB$$e9a65c63] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-08-14 16:54:55.588 INFO 6676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8082 (http)
2018-08-14 16:54:55.611 INFO 6676 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-08-14 16:54:55.611 INFO 6676 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.32
2018-08-14 16:54:55.616 INFO 6676 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:Program FilesJavajdk1.8.0_131bin;C:windowsSunJavabin;C:windowssystem32;C:windows;C:/Program Files/Java/jre1.8.0_131/bin/server;C:/Program Files/Java/jre1.8.0_131/bin;C:/Program Files/Java/jre1.8.0_131/lib/amd64;C:Program FilesDockerDockerResourcesbin;C:Program Files (x86)Common FilesOracleJavajavapath;C:ProgramDataOracleJavajavapath;C:windowssystem32;C:windows;C:windowsSystem32Wbem;C:windowsSystem32WindowsPowerShellv1.0;c:Program FilesTortoiseSVNbin;C:Program FilesPuTTY;C:Usersprabin.tripathiprojectsR45pbapba_buildenvdevMavenmaven-2.0.7bin;C:Program FilesJavajdk1.8.0_131bin;C:Program Filesnodejs;C:Program Files (x86)SymantecVIP Access Client;C:Program FilesGitcmd;C:HashiCorpVagrantbin;C:Usersprabin.tripathiAppDataLocalMicrosoftWindowsApps;C:Program FilesMicrosoft VS Codebin;C:Usersprabin.tripathiAppDataRoamingnpm;C:Usersprabin.tripathiAppDataLocalGitHubDesktopbin;C:Usersprabin.tripathiSTSsts-bundlests-3.9.5.RELEASE;;.]
2018-08-14 16:54:55.821 INFO 6676 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-08-14 16:54:55.821 INFO 6676 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2081 ms
2018-08-14 16:54:55.935 INFO 6676 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-08-14 16:54:55.941 INFO 6676 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-08-14 16:54:55.941 INFO 6676 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-08-14 16:54:55.941 INFO 6676 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-08-14 16:54:55.941 INFO 6676 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-08-14 16:54:56.415 INFO 6676 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler'
2018-08-14 16:54:56.468 WARN 6676 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.task.launcher.TaskLauncherSink': Unsatisfied dependency expressed through field 'taskLauncher'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.deployer.spi.task.TaskLauncher' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2018-08-14 16:54:56.468 INFO 6676 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler'
2018-08-14 16:54:56.472 INFO 6676 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-08-14 16:54:56.485 INFO 6676 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-08-14 16:54:56.653 ERROR 6676 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field taskLauncher in org.springframework.cloud.task.launcher.TaskLauncherSink required a bean of type 'org.springframework.cloud.deployer.spi.task.TaskLauncher' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.cloud.deployer.spi.task.TaskLauncher' in your configuration.
我POM.xml
如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pluralsight.demo</groupId>
<artifactId>pluralsight-springcloud-m3-taskintake</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>pluralsight-springcloud-m3-taskintake</name>
<description>task intake mrociservcies</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud-task.version>2.0.0.RELEASE</spring-cloud-task.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-task-dependencies</artifactId>
<version>${spring-cloud-task.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
application.properties
如下:
server:
port: 8082
spring:
rabbitmq:
username: ****
password: ****
host: localhost
port: 5672
cloud:
stream:
bindings:
input:
destination: tasktopic
我刚刚遇到了同样的问题,我通过任务启动器本地示例解决了它。我需要做的是将部署程序本地依赖项添加到我的 pom 文件中。
特别是,添加以下句子解决了该问题:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-deployer-local</artifactId>
<version>1.3.7.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>
我遇到了同样的问题,并用pom的这一部分修复了这个问题.xml
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-deployer-local</artifactId>
<version>1.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<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>