Java 运行 Spring Boot APP 时的 Spring Boot 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36601812/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 18:28:45  来源:igfitidea点击:

Spring Boot Issue while Running the Spring Boot APP

javaspringspring-boot

提问by user2497684

I am trying to run my spring boot app.This time i got error as shown below :

我正在尝试运行我的 Spring Boot 应用程序。这次我遇到了如下所示的错误:

.   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
[32m :: Spring Boot :: [39m      [2m (v1.3.3.RELEASE)[0;39m

[2m2016-04-13 19:56:36.427[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mcom.example.SampleApplication           [0;39m [2m:[0;39m Starting SampleApplication on kasi-PC with PID 4756 (E:\WS\Sample\target\classes started by kasi in E:\WS\Sample)
[2m2016-04-13 19:56:36.429[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mcom.example.SampleApplication           [0;39m [2m:[0;39m No active profile set, falling back to default profiles: default
[2m2016-04-13 19:56:36.505[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mationConfigEmbeddedWebApplicationContext[0;39m [2m:[0;39m Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@10b48321: startup date [Wed Apr 13 19:56:36 IST 2016]; root of context hierarchy
[2m2016-04-13 19:56:37.313[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.b.f.s.DefaultListableBeanFactory    [0;39m [2m:[0;39m Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
[2m2016-04-13 19:56:38.100[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36ms.b.c.e.t.TomcatEmbeddedServletContainer[0;39m [2m:[0;39m Tomcat initialized with port(s): 8080 (http)
[2m2016-04-13 19:56:38.118[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.apache.catalina.core.StandardService  [0;39m [2m:[0;39m Starting service Tomcat
[2m2016-04-13 19:56:38.120[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36morg.apache.catalina.core.StandardEngine [0;39m [2m:[0;39m Starting Servlet Engine: Apache Tomcat/8.0.32
[2m2016-04-13 19:56:38.280[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/]      [0;39m [2m:[0;39m Initializing Spring embedded WebApplicationContext
[2m2016-04-13 19:56:38.280[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.web.context.ContextLoader           [0;39m [2m:[0;39m Root WebApplicationContext: initialization completed in 1779 ms
[2m2016-04-13 19:56:38.677[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.c.e.ServletRegistrationBean       [0;39m [2m:[0;39m Mapping servlet: 'dispatcherServlet' to [/]
[2m2016-04-13 19:56:38.682[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.c.embedded.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'characterEncodingFilter' to: [/*]
[2m2016-04-13 19:56:38.683[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.c.embedded.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
[2m2016-04-13 19:56:38.683[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.c.embedded.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'httpPutFormContentFilter' to: [/*]
[2m2016-04-13 19:56:38.683[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.c.embedded.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'requestContextFilter' to: [/*]
[2m2016-04-13 19:56:39.030[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerAdapter[0;39m [2m:[0;39m Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@10b48321: startup date [Wed Apr 13 19:56:36 IST 2016]; root of context hierarchy
[2m2016-04-13 19:56:39.107[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/get]}" onto java.lang.String com.example.SampleApplication.get()
[2m2016-04-13 19:56:39.110[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m 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)
[2m2016-04-13 19:56:39.111[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m 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)
[2m2016-04-13 19:56:39.142[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.w.s.handler.SimpleUrlHandlerMapping [0;39m [2m:[0;39m Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[2m2016-04-13 19:56:39.142[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.w.s.handler.SimpleUrlHandlerMapping [0;39m [2m:[0;39m Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[2m2016-04-13 19:56:39.193[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.w.s.handler.SimpleUrlHandlerMapping [0;39m [2m:[0;39m Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[2m2016-04-13 19:56:39.322[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.j.e.a.AnnotationMBeanExporter       [0;39m [2m:[0;39m Registering beans for JMX exposure on startup
[2m2016-04-13 19:56:39.383[0;39m [31mERROR[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.a.coyote.http11.Http11NioProtocol     [0;39m [2m:[0;39m Failed to start end point associated with ProtocolHandler ["http-nio-8080"]

java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_77]
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[na:1.8.0_77]
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) ~[na:1.8.0_77]
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:765) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:473) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:986) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.core.StandardService.addConnector(StandardService.java:239) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:194) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:151) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at com.example.SampleApplication.main(SampleApplication.java:20) [classes/:na]

[2m2016-04-13 19:56:39.385[0;39m [31mERROR[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.apache.catalina.core.StandardService  [0;39m [2m:[0;39m 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:153) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.core.StandardService.addConnector(StandardService.java:239) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:194) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:151) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at com.example.SampleApplication.main(SampleApplication.java:20) [classes/:na]
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat";  Protocol handler start failed
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:993) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    ... 13 common frames omitted
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_77]
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[na:1.8.0_77]
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) ~[na:1.8.0_77]
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:765) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:473) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:986) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    ... 14 common frames omitted

[2m2016-04-13 19:56:39.395[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.apache.catalina.core.StandardService  [0;39m [2m:[0;39m Stopping service Tomcat
[2m2016-04-13 19:56:39.406[0;39m [31mERROR[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.boot.SpringApplication              [0;39m [2m:[0;39m Application startup failed

org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat servlet container
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:165) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at com.example.SampleApplication.main(SampleApplication.java:20) [classes/:na]
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:159) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    ... 10 common frames omitted

[2m2016-04-13 19:56:39.409[0;39m [32m INFO[0;39m [35m4756[0;39m [2m---[0;39m [2m[           main][0;39m [36m.b.l.ClasspathLoggingApplicationListener[0;39m [2m:[0;39m Application failed to start with classpath: [file:/E:/WS/Sample/target/classes/, file:/C:/Users/kasi/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.3.3.RELEASE/spring-boot-starter-web-1.3.3.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/boot/spring-boot-starter/1.3.3.RELEASE/spring-boot-starter-1.3.3.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/boot/spring-boot/1.3.3.RELEASE/spring-boot-1.3.3.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.3.RELEASE/spring-boot-autoconfigure-1.3.3.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.3.RELEASE/spring-boot-starter-logging-1.3.3.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/ch/qos/logback/logback-classic/1.1.5/logback-classic-1.1.5.jar, file:/C:/Users/kasi/.m2/repository/ch/qos/logback/logback-core/1.1.5/logback-core-1.1.5.jar, file:/C:/Users/kasi/.m2/repository/org/slf4j/slf4j-api/1.7.16/slf4j-api-1.7.16.jar, file:/C:/Users/kasi/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.16/jcl-over-slf4j-1.7.16.jar, file:/C:/Users/kasi/.m2/repository/org/slf4j/jul-to-slf4j/1.7.16/jul-to-slf4j-1.7.16.jar, file:/C:/Users/kasi/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.16/log4j-over-slf4j-1.7.16.jar, file:/C:/Users/kasi/.m2/repository/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.3.3.RELEASE/spring-boot-starter-tomcat-1.3.3.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.32/tomcat-embed-core-8.0.32.jar, file:/C:/Users/kasi/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.32/tomcat-embed-el-8.0.32.jar, file:/C:/Users/kasi/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.32/tomcat-embed-logging-juli-8.0.32.jar, file:/C:/Users/kasi/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.32/tomcat-embed-websocket-8.0.32.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/boot/spring-boot-starter-validation/1.3.3.RELEASE/spring-boot-starter-validation-1.3.3.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar, file:/C:/Users/kasi/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/C:/Users/kasi/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar, file:/C:/Users/kasi/.m2/repository/com/fasterxml/classmate/1.1.0/classmate-1.1.0.jar, file:/C:/Users/kasi/.m2/repository/com/fasterxml/Hymanson/core/Hymanson-databind/2.6.5/Hymanson-databind-2.6.5.jar, file:/C:/Users/kasi/.m2/repository/com/fasterxml/Hymanson/core/Hymanson-annotations/2.6.5/Hymanson-annotations-2.6.5.jar, file:/C:/Users/kasi/.m2/repository/com/fasterxml/Hymanson/core/Hymanson-core/2.6.5/Hymanson-core-2.6.5.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/spring-web/4.2.5.RELEASE/spring-web-4.2.5.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/spring-aop/4.2.5.RELEASE/spring-aop-4.2.5.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/spring-beans/4.2.5.RELEASE/spring-beans-4.2.5.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/spring-context/4.2.5.RELEASE/spring-context-4.2.5.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/spring-webmvc/4.2.5.RELEASE/spring-webmvc-4.2.5.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/spring-expression/4.2.5.RELEASE/spring-expression-4.2.5.RELEASE.jar, file:/C:/Users/kasi/.m2/repository/org/springframework/spring-core/4.2.5.RELEASE/spring-core-4.2.5.RELEASE.jar]

I am new to spring boot ,so i didn't get any idea to solve this.Please suggest me how to solve it?

我是 Spring Boot 的新手,所以我不知道如何解决这个问题。请建议我如何解决它?

May i know the problem of this issue.

我可以知道这个问题的问题。

Thanks in Advance.

提前致谢。

回答by f1sh

java.net.BindException: Address already in use: bind

means that the port of your server (8080) is already in use. Make sure that your webserver is not running anymore from any previous starts.

表示您服务器的端口 (8080) 已在使用中。确保您的网络服务器不再从以前的任何启动开始运行。

Also check if there is any other application running on that port. Try to open http://localhost:8080/to get a hint what's running there.

还要检查是否有任何其他应用程序在该端口上运行。尝试打开http://localhost:8080/以获取在那里运行的提示。

回答by Arvin Sanmuga Rajah

enter image description here

在此处输入图片说明

Before running your Spring Boot App, click the red 'stop' button as shown above to first stop the server from running so that the port can be re-used. Then run your Spring Boot App.

在运行您的 Spring Boot 应用程序之前,请单击如上所示的红色“停止”按钮,首先停止服务器运行,以便可以重新使用该端口。然后运行你的 Spring Boot 应用程序。

Hope it helps!

希望能帮助到你!

回答by Raj Wadhwa

Spring Boot uses port 8080 as the default port for the Inbuilt Apache Tomcat container. We can override it in many ways. One such way it to do it programmatically, given below.

Spring Boot 使用端口 8080 作为内置 Apache Tomcat 容器的默认端口。我们可以通过多种方式覆盖它。一种以编程方式执行此操作的方式,如下所示。

Create this component. And compile and run your app. Change Port as per requirement.

创建此组件。并编译并运行您的应用程序。根据要求更改端口。

@Component
public class CustomizationBean implements EmbeddedServletContainerCustomizer {
    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
        container.setPort(8085);
        // Use port of your choice that is available
    }
}

回答by Danushka Chathuranga

goto task manager -> processes and end Java(TM) Platform SE binary processes (this will stop tomcat) and run your spring boot application again.

转到任务管理器 -> 处理并结束 Java(TM) Platform SE 二进制进程(这将停止 tomcat)并再次运行您的 Spring Boot 应用程序。

回答by darkconeja

If you want to run 2 instances of the same app, first check that the port configuration for both is different, then make sure the plugin you are using to run it is not checking for changes in the files and reloading your first instance, because what could be happening is that when you change your port for your second instance, the plugin is already relaunching the first one using this port, so when you run your second instance, port is already busy.

如果你想运行同一个应用程序的 2 个实例,首先检查两者的端口配置是否不同,然后确保你用来运行它的插件没有检查文件中的更改并重新加载你的第一个实例,因为什么可能发生的情况是,当您更改第二个实例的端口时,插件已经使用此端口重新启动第一个实例,因此当您运行第二个实例时,端口已经很忙。

回答by Srinidhi N

Faced the same issue. You could actually override tomcat port by just including application.properties under src/main/resources

面临同样的问题。您实际上可以通过在 src/main/resources 下包含 application.properties 来覆盖 tomcat 端口

application.properties file may look like

application.properties 文件可能看起来像

server.port = 8443
#below lines for SSL
#server.ssl.key-store = classpath:sample.jks
#server.ssl.key-store-password = secret
#server.ssl.key-password = password

Regards,

问候,

Srinidhi

斯里尼迪

回答by Kunal Shira

Follow steps to kill process on port

按照步骤杀死端口上的进程

1] In command line interface

1]在命令行界面

netstat -aon | find /i "listening"

2] Find port 8080 Ctrl+F and Enter 8080 (Port number of a process you want to kill)

2] 找到端口 8080 Ctrl+F 并输入 8080(要杀死的进程的端口号)

3] Kill it's associated process id.

3]杀死它的关联进程ID。

Taskkill /PID ProcessNumber /F

Taskkill /PID 进程号 /F

Taskkill /PID 3440 /F

and rerun program

并重新运行程序

References : List Processes, Kill a Process

参考资料:列出进程杀死进程

回答by shubham bellale

Solved! I have also faced this problem. it having many causes two instance running on same port. and also check the attributes of Expression languagein jsp matches with controller model attributes. also check the Request Mapping proper or not. in my case missing only '/' symbol that's why it throws this error.

解决了!我也遇到过这个问题。它有很多原因导致两个实例在同一端口上运行。并检查jsp中表达式语言属性是否与控制器模型属性匹配。还要检查请求映射是否正确。在我的情况下,只缺少“/”符号,这就是它抛出此错误的原因。

回答by Manoj kumar

Check the running processing using the below command. netstat -ano | findstr :

使用以下命令检查正在运行的处理。 netstat -ano | 查找字符串:

If any results found in the below command then kill the processes using the below command.

如果在以下命令中找到任何结果,则使用以下命令终止进程。

taskkill /PID /FNote: /F is used to force the kill process

taskkill /PID /F注意:/F 用于强制杀死进程

回答by Kamalesh Maurya

Run the command with the port used: example: lsof -i : 8080(Port number)

使用使用的端口运行命令:示例: lsof -i : 8080(Port number)

Now kill the process. command -: kill -9 <PID>(example : kill -9 8080).

现在杀死进程。命令 -:(kill -9 <PID>例如:)kill -9 8080