我需要轮询S3存储桶中的文件,并在任何文件可用后立即对其进行处理。我需要使用Spring Integration和spring-integration- aws进行此操作。所以我到目前为止的代码看起来像这样:
public AmazonS3 amazonS3 = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey));`enter code here` @Bean public S3InboundFileSynchronizer s3InboundFileSynchronizer() { S3InboundFileSynchronizer synchronizer = new S3InboundFileSynchronizer(amazonS3); synchronizer.setDeleteRemoteFiles(true); synchronizer.setPreserveTimestamp(true); synchronizer.setRemoteDirectory(s3BucketName.concat("/").concat(s3InboundFolder)); synchronizer.setFilter(new S3RegexPatternFileListFilter(".*\\.dat\\.{0,1}\\d{0,2}")); return synchronizer; } @Bean @InboundChannelAdapter(value = "s3FilesChannel", poller = @Poller(fixedDelay = "10")) public S3InboundFileSynchronizingMessageSource s3InboundFileSynchronizingMessageSource() { S3InboundFileSynchronizingMessageSource messageSource = new S3InboundFileSynchronizingMessageSource(s3InboundFileSynchronizer()); messageSource.setAutoCreateLocalDirectory(true); messageSource.setLocalDirectory(new File(inboundDir)); messageSource.setLocalFilter(new AcceptOnceFileListFilter<File>()); return messageSource; } @Bean public PollableChannel s3FilesChannel() { return new QueueChannel(); }
然后我有一个FileReadingFlow像这样:
@Bean IntegrationFlow fileReadingFlow() { return IntegrationFlows .from(s3InboundFileSynchronizingMessageSource(), e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS))) .handle(fileProcessor()) .get(); }
但我一直收到“无法分配请求的地址:绑定”错误。这是堆栈跟踪-
2017-04-13 17:16:45.315 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource servletConfigInitParams [org.springframework.core.env.PropertySource$StubPropertySource] to EncryptablePropertySourceWrapper 2017-04-13 17:16:45.315 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource servletContextInitParams [org.springframework.core.env.PropertySource$StubPropertySource] to EncryptablePropertySourceWrapper 2017-04-13 17:16:45.315 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource systemProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2017-04-13 17:16:45.315 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource systemEnvironment [org.springframework.core.env.SystemEnvironmentPropertySource] to EncryptableMapPropertySourceWrapper 2017-04-13 17:16:45.315 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource random [org.springframework.boot.context.config.RandomValuePropertySource] to EncryptablePropertySourceWrapper 2017-04-13 17:16:45.325 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource applicationConfig: [classpath:/application-dev.properties] [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper 2017-04-13 17:16:45.325 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource applicationConfig: [classpath:/application.properties] [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper 2017-04-13 17:16:45.325 INFO 4440 --- [ restartedMain] eEncryptablePropertySourcesPostProcessor : Converting PropertySource refresh [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2017-04-13 17:16:45.345 INFO 4440 --- [ restartedMain] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created. 2017-04-13 17:16:46.515 INFO 4440 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.retry.annotation.RetryConfiguration' of type [class org.springframework.retry.annotation.RetryConfiguration$$EnhancerBySpringCGLIB$$6d590986] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-04-13 17:16:47.035 INFO 4440 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$77957161] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-04-13 17:16:47.525 INFO 4440 --- [ restartedMain] o.s.b.f.config.PropertiesFactoryBean : Loading properties file from URL [jar:file:/C:/Users/atare/.gradle/caches/modules-2/files-2.1/org.springframework.integration/spring-integration-core/4.3.5.RELEASE/5fb7134905e7cd34dfd6e95b4e58102b0e09cf38/spring-integration-core-4.3.5.RELEASE.jar!/META-INF/spring.integration.default.properties] 2017-04-13 17:16:47.535 INFO 4440 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'integrationGlobalProperties' of type [class org.springframework.beans.factory.config.PropertiesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-04-13 17:16:47.545 INFO 4440 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'integrationGlobalProperties' of type [class java.util.Properties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-04-13 17:16:51.905 INFO 4440 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (https) 2017-04-13 17:16:51.945 INFO 4440 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service Tomcat 2017-04-13 17:16:51.955 INFO 4440 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6 2017-04-13 17:16:52.725 INFO 4440 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2017-04-13 17:16:52.725 INFO 4440 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 17034 ms 2017-04-13 17:16:56.803 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2017-04-13 17:16:56.823 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*] 2017-04-13 17:16:56.823 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2017-04-13 17:16:56.823 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2017-04-13 17:16:56.823 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2017-04-13 17:16:56.823 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2017-04-13 17:16:56.823 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*] 2017-04-13 17:16:56.823 INFO 4440 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*] 2017-04-13 17:20:03.623 INFO 4440 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@31ea2fb2: startup date [Thu Apr 13 17:16:35 PDT 2017]; root of context hierarchy 2017-04-13 17:20:04.313 INFO 4440 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2017-04-13 17:20:04.313 INFO 4440 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2017-04-13 17:20:05.033 INFO 4440 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-04-13 17:20:05.033 INFO 4440 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-04-13 17:20:06.797 INFO 4440 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-04-13 17:20:11.022 INFO 4440 --- [ restartedMain] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler' 2017-04-13 17:20:16.399 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/logfile || /logfile.json],methods=[GET || HEAD]}" onto public void org.springframework.boot.actuate.endpoint.mvc.LogFileMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException 2017-04-13 17:20:16.410 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException 2017-04-13 17:20:16.436 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.445 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String) 2017-04-13 17:20:16.447 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.454 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.461 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.469 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.475 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.482 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal) 2017-04-13 17:20:16.517 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String) 2017-04-13 17:20:16.519 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.524 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:16.530 INFO 4440 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-04-13 17:20:19.238 INFO 4440 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2017-04-13 17:20:22.018 INFO 4440 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2017-04-13 17:20:22.189 INFO 4440 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'integrationMbeanExporter' has been autodetected for JMX exposure 2017-04-13 17:20:22.273 INFO 4440 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'integrationMbeanExporter': registering with JMX server as MBean [org.springframework.integration.monitor:name=integrationMbeanExporter,type=IntegrationMBeanExporter] 2017-04-13 17:20:22.685 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registering beans for JMX exposure on startup 2017-04-13 17:20:22.688 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorChannel 2017-04-13 17:20:22.730 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=errorChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorChannel] 2017-04-13 17:20:23.373 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel s3FilesChannel 2017-04-13 17:20:23.396 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=s3FilesChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=s3FilesChannel] 2017-04-13 17:20:23.672 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel nullChannel 2017-04-13 17:20:23.701 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=nullChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=nullChannel] 2017-04-13 17:20:23.900 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel toMessageProcessing 2017-04-13 17:20:23.924 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=toMessageProcessing': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=toMessageProcessing] 2017-04-13 17:20:24.271 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel fileReadingFlow.channel#0 2017-04-13 17:20:24.298 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=fileReadingFlow.channel#0': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=fileReadingFlow.channel#0] 2017-04-13 17:20:24.746 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorSubFlow.input 2017-04-13 17:20:24.803 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=errorSubFlow.input': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorSubFlow.input] 2017-04-13 17:20:25.288 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=errorChannel,bean=anonymous': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorChannel,bean=anonymous] 2017-04-13 17:20:25.565 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=errorSubFlow.input,bean=anonymous': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorSubFlow.input,bean=anonymous] 2017-04-13 17:20:25.870 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=fileReadingFlow.channel#0,bean=anonymous': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=fileReadingFlow.channel#0,bean=anonymous] 2017-04-13 17:20:26.108 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageSource,name=applicationConfig.s3InboundFileSynchronizingMessageSource.inboundChannelAdapter,bean=endpoint': registering with JMX server as MBean [org.springframework.integration:type=MessageSource,name=applicationConfig.s3InboundFileSynchronizingMessageSource.inboundChannelAdapter,bean=endpoint] 2017-04-13 17:20:26.325 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=ManagedEndpoint,name=org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0,bean=endpoint': registering with JMX server as MBean [org.springframework.integration:type=ManagedEndpoint,name=org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0,bean=endpoint] 2017-04-13 17:20:26.376 INFO 4440 --- [ restartedMain] o.s.i.monitor.IntegrationMBeanExporter : Registered endpoint without MessageSource: org.springframework.integration:type=ManagedEndpoint,name=org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0,bean=endpoint 2017-04-13 17:20:26.576 INFO 4440 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2017-04-13 17:20:27.278 INFO 4440 --- [ restartedMain] o.s.i.e.SourcePollingChannelAdapter : started applicationConfig.s3InboundFileSynchronizingMessageSource.inboundChannelAdapter 2017-04-13 17:20:27.279 INFO 4440 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : Adding {bridge} as a subscriber to the 'errorSubFlow.input' channel 2017-04-13 17:20:27.281 INFO 4440 --- [ restartedMain] o.s.integration.channel.DirectChannel : Channel 'application:dev.errorSubFlow.input' has 1 subscriber(s). 2017-04-13 17:20:27.282 INFO 4440 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : started org.springframework.integration.config.ConsumerEndpointFactoryBean#0 2017-04-13 17:20:27.284 INFO 4440 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : Adding {service-activator} as a subscriber to the 'fileReadingFlow.channel#0' channel 2017-04-13 17:20:27.285 INFO 4440 --- [ restartedMain] o.s.integration.channel.DirectChannel : Channel 'application:dev.fileReadingFlow.channel#0' has 1 subscriber(s). 2017-04-13 17:20:27.285 INFO 4440 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : started org.springframework.integration.config.ConsumerEndpointFactoryBean#2 2017-04-13 17:20:27.286 INFO 4440 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 1073741823 2017-04-13 17:20:27.290 INFO 4440 --- [ restartedMain] o.s.i.endpoint.PollingConsumer : started org.springframework.integration.config.ConsumerEndpointFactoryBean#1 2017-04-13 17:20:27.294 INFO 4440 --- [ restartedMain] o.s.i.e.SourcePollingChannelAdapter : started org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0 2017-04-13 17:20:27.714 ERROR 4440 --- [ restartedMain] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler [https-jsse-nio-50.18.174.237-8080] java.net.BindException: Cannot assign requested address: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind(Net.java:425) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:228) at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:874) at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:590) at org.apache.catalina.connector.Connector.startInternal(Connector.java:969) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:233) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:178) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) at com.nike.nikecoupagateway.inboundasnservice.InboundAsnApplication.main(InboundAsnApplication.java:11) 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:497) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 2017-04-13 17:20:27.723 ERROR 4440 --- [ restartedMain] o.apache.catalina.core.StandardService : Failed to start connector [Connector[HTTP/1.1-8080]] org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8080]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:233) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:178) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) at com.nike.nikecoupagateway.inboundasnservice.InboundAsnApplication.main(InboundAsnApplication.java:11) 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:497) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed at org.apache.catalina.connector.Connector.startInternal(Connector.java:976) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 18 common frames omitted Caused by: java.net.BindException: Cannot assign requested address: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind(Net.java:425) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:228) at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:874) at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:590) at org.apache.catalina.connector.Connector.startInternal(Connector.java:969) ... 19 common frames omitted Description: The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured. Action: Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
我究竟做错了什么?
您正在将Spring Boot与嵌入式Tomcat服务器一起使用,并且端口8080已在使用中…
配置为侦听端口8080的Tomcat连接器无法启动。该端口可能已在使用中,或者连接器配置错误。
您需要停止其他服务器,将server.port属性更改为其他端口(0将使用随机端口),或禁用引导的嵌入式tomcat服务器。参见Spring Boot参考手册。
server.port
这与Spring Integration或Spring AWS没有关系。