Java Spring Boot 无法启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28203698/
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 05:47:01  来源:igfitidea点击:

Spring Boot fails to start

javaspring-mvctomcat

提问by Daniil Shevelev

I have a Spring Boot app, which ran fine on my Windows machine, but is now failing to start on my xUbuntu VM running on Virtual Box.
I call it using following command:

我有一个 Spring Boot 应用程序,它在我的 Windows 机器上运行良好,但现在无法在我在 Virtual Box 上运行的 xUbuntu VM 上启动。
我使用以下命令调用它:

java -Djava.net.preferIPv4Stack=true -jar -Xmx1500m highlighter-0.0.1.jar

I added -Djava.net.preferIPv4Stack=trueafter reading thesemultipleanswers, but it did not solve the issue.

-Djava.net.preferIPv4Stack=true在阅读了这些多个答案后补充道,但并没有解决问题。

I get following error:

我收到以下错误:

2015-01-28 17:20:02.844 DEBUG 18612 --- [           main] o.s.w.s.resource.ResourceUrlProvider     : Looking for resource handler mappings
2015-01-28 17:20:02.845 DEBUG 18612 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'viewControllerHandlerMapping'
2015-01-28 17:20:02.845 DEBUG 18612 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'resourceHandlerMapping'
2015-01-28 17:20:02.845 DEBUG 18612 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'faviconHandlerMapping'
2015-01-28 17:20:02.845 DEBUG 18612 --- [           main] o.s.w.s.resource.ResourceUrlProvider     : Found resource handler mapping: URL pattern="/**/favicon.ico", locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2e9e8b52]
2015-01-28 17:20:02.845 DEBUG 18612 --- [           main] o.s.w.s.resource.ResourceUrlProvider     : Found resource handler mapping: URL pattern="/webjars/**", locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@6a90f803]
2015-01-28 17:20:02.846 DEBUG 18612 --- [           main] o.s.w.s.resource.ResourceUrlProvider     : Found resource handler mapping: URL pattern="/**", locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@c09fd55]
2015-01-28 17:20:02.847 DEBUG 18612 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'spring.liveBeansView.mbeanDomain' in [servletConfigInitParams]
2015-01-28 17:20:02.847 DEBUG 18612 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'spring.liveBeansView.mbeanDomain' in [servletContextInitParams]
2015-01-28 17:20:02.847 DEBUG 18612 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
2015-01-28 17:20:02.847 DEBUG 18612 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
2015-01-28 17:20:02.847 DEBUG 18612 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'spring.liveBeansView.mbeanDomain' in [random]
2015-01-28 17:20:02.847 DEBUG 18612 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'spring.liveBeansView.mbeanDomain' in [applicationConfig: [file:./application.properties]]
2015-01-28 17:20:02.847 DEBUG 18612 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
2015-01-28 17:20:02.870 ERROR 18612 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Failed to start end point associated with ProtocolHandler ["http-nio-80"]

java.net.SocketException: Permission denied
   at sun.nio.ch.Net.bind0(Native Method)
   at sun.nio.ch.Net.bind(Net.java:436)
   at sun.nio.ch.Net.bind(Net.java:428)
   at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
   at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
   at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:343)
   at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:737)
   at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:471)
   at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:80)
   at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   at org.apache.catalina.core.StandardService.addConnector(StandardService.java:237)
   at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186)
   at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
   at com.dash.nlpHighlight.web.App.main(App.java:16)
   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:483)
   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
   at java.lang.Thread.run(Thread.java:745)

2015-01-28 17:20:02.872 ERROR 18612 --- [           main] o.apache.catalina.core.StandardService   : Failed to start connector [Connector[HTTP/1.1-80]]

org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-80]]
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
   at org.apache.catalina.core.StandardService.addConnector(StandardService.java:237)
   at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186)
   at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
   at com.dash.nlpHighlight.web.App.main(App.java:16)
   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:483)
   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
   at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat";  Protocol handler start failed
   at org.apache.catalina.connector.Connector.startInternal(Connector.java:993)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   ... 18 common frames omitted
Caused by: java.net.SocketException: Permission denied
   at sun.nio.ch.Net.bind0(Native Method)
   at sun.nio.ch.Net.bind(Net.java:436)
   at sun.nio.ch.Net.bind(Net.java:428)
   at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
   at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
   at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:343)
   at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:737)
   at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:471)
   at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:80)
   at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
   ... 19 common frames omitted

2015-01-28 17:20:02.886  INFO 18612 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tomcat
2015-01-28 17:20:02.911  INFO 18612 --- [           main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-web-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/stanford-corenlp-3.5.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/stanford-corenlp-3.5.0-models.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/junit-4.12.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-tomcat-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/Hymanson-databind-2.4.4.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/hibernate-validator-5.1.3.Final.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-core-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-web-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-webmvc-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xom-1.2.10.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/joda-time-2.1.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jollyday-0.4.7.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/ejml-0.23.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/javax.json-api-1.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/hamcrest-core-1.3.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-autoconfigure-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-logging-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/snakeyaml-1.14.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-core-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-el-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-logging-juli-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-websocket-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/Hymanson-annotations-2.4.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/Hymanson-core-2.4.4.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/validation-api-1.1.0.Final.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jboss-logging-3.1.3.GA.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/classmate-1.0.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-aop-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-beans-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-context-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-expression-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xercesImpl-2.8.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xalan-2.7.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jaxb-api-2.2.7.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jcl-over-slf4j-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jul-to-slf4j-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/log4j-over-slf4j-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/logback-classic-1.1.2.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/aopalliance-1.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/slf4j-api-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/logback-core-1.1.2.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xml-apis-2.0.2.jar!/]
2015-01-28 17:20:02.913 DEBUG 18612 --- [           main] utoConfigurationReportLoggingInitializer : 


=========================
AUTO-CONFIGURATION REPORT
=========================
...
2015-01-28 17:20:02.918 ERROR 18612 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.IllegalStateException: Tomcat connector in failed state
   at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
   at com.dash.nlpHighlight.web.App.main(App.java:16)
   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:483)
   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
   at java.lang.Thread.run(Thread.java:745)

2015-01-28 17:20:02.919  INFO 18612 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5b5ba2dc: startup date [Wed Jan 28 17:19:37 EST 2015]; root of context hierarchy
2015-01-28 17:20:02.919 DEBUG 18612 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'lifecycleProcessor'
2015-01-28 17:20:02.920 DEBUG 18612 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3e1057f5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,sampleController,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,org.springframework.boot.autoconfigure.AutoConfigurationPackages,org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration,org.springframework.boot.autoconfigure.condition.BeanTypeRegistry,propertySourcesPlaceholderConfigurer,org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat,tomcatEmbeddedServletContainerFactory,org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,embeddedServletContainerCustomizerBeanPostProcessor,org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration,dispatcherServlet,dispatcherServletRegistration,org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration,org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration,error,beanNameViewResolver,org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration,errorAttributes,basicErrorController,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration,requestMappingHandlerAdapter,requestMappingHandlerMapping,mvcContentNegotiationManager,viewControllerHandlerMapping,beanNameHandlerMapping,resourceHandlerMapping,mvcResourceUrlProvider,defaultServletHandlerMapping,mvcConversionService,mvcValidator,mvcPathMatcher,mvcUrlPathHelper,mvcUriComponentsContributor,httpRequestHandlerAdapter,simpleControllerHandlerAdapter,handlerExceptionResolver,mvcViewResolver,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration,faviconHandlerMapping,faviconRequestHandler,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter,defaultViewResolver,requestContextListener,viewResolver,spring.mvc.CONFIGURATION_PROPERTIES,spring.resources.CONFIGURATION_PROPERTIES,org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor,org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration,hiddenHttpMethodFilter,org.springframework.boot.autoconfigure.Hymanson.HymansonAutoConfiguration$HymansonObjectMapperBuilderConfiguration,HymansonObjectMapperBuilder,http.mappers.CONFIGURATION_PROPERTIES,spring.Hymanson.CONFIGURATION_PROPERTIES,org.springframework.boot.autoconfigure.Hymanson.HymansonAutoConfiguration$HymansonObjectMapperConfiguration,HymansonObjectMapper,org.springframework.boot.autoconfigure.Hymanson.HymansonAutoConfiguration,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration,stringHttpMessageConverter,spring.http.encoding.CONFIGURATION_PROPERTIES,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$MappingHymanson2HttpMessageConverterConfiguration,mappingHymanson2HttpMessageConverter,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration,messageConverters,org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,mbeanExporter,objectNamingStrategy,mbeanServer,org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration,characterEncodingFilter,org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration,multipartConfigElement,multipartResolver,multipart.CONFIGURATION_PROPERTIES,org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,serverProperties]; root of factory hierarchy
2015-01-28 17:20:02.922 DEBUG 18612 --- [           main] o.s.b.f.support.DisposableBeanAdapter    : Invoking destroy() on bean with name 'mbeanExporter'
2015-01-28 17:20:02.922  INFO 18612 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2015-01-28 17:20:02.923 DEBUG 18612 --- [           main] o.s.b.f.support.DisposableBeanAdapter    : Invoking destroy() on bean with name 'mvcValidator'
2015-01-28 17:20:02.924 DEBUG 18612 --- [           main] o.s.b.f.support.DisposableBeanAdapter    : Invoking destroy() on bean with name 'characterEncodingFilter'
2015-01-28 17:20:02.924 DEBUG 18612 --- [           main] o.s.b.f.support.DisposableBeanAdapter    : Invoking destroy() on bean with name 'hiddenHttpMethodFilter'
2015-01-28 17:20:02.924 DEBUG 18612 --- [           main] o.s.b.f.support.DisposableBeanAdapter    : Invoking destroy() on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor'
java.lang.reflect.InvocationTargetException
   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:483)
   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
   at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
   at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
   at com.dash.nlpHighlight.web.App.main(App.java:16)
   ... 6 more

回答by Daniil Shevelev

I found the answer here:

我在这里找到了答案:

According to w3.org docports below 1024 are priviledged on Linux. Only root can bind to such ports. You should either use ports >1024 or run under root account (not recommended).

根据w3.org 文档,低于 1024 的端口在 Linux 上是特权的。只有 root 可以绑定到这些端口。您应该使用大于 1024 的端口或在 root 帐户下运行(不推荐)。

The solution is to set different port in "application.properties" file, e.g. server.port=${port:8181}or to run as root using sudo(not recommended).

解决方案是在“application.properties”文件中设置不同的端口,例如server.port=${port:8181}或以root身份运行sudo(不推荐)。

回答by Yura

sometimes you can get same error on cloud env like openshift, cause localhost is not allowed there, you need also specify IP while starting app with param

有时你会在像 openshift 这样的云环境上遇到同样的错误,因为那里不允许 localhost,你还需要在使用参数启动应用程序时指定 IP

--server.address=$OPENSHIFT_DIY_IP

回答by begginghard

Change the listening port to 8181

将监听端口改为8181

java -Djava.net.preferIPv4Stack=true -jar -Xmx1500m highlighter-0.0.1.jar -Dserver.port=8181

Port numbers have a range of 0..65535 (although often 0 has special meaning). In the original BSD TCP implementation, only root can bind to ports 1..1023, and dynamically assigned ports were assigned from the range 1024..5000.

端口号的范围为 0..65535(虽然通常 0 有特殊含义)。在最初的 BSD TCP 实现中,只有 root 可以绑定到端口 1..1023,并且动态分配的端口是从 1024..5000 范围内分配的。

回答by Sandeep Shinde

In java API Class to add System.setProperty("java.net.preferIPv4Stack", "true"); this line.

在java API Class中添加System.setProperty("java.net.preferIPv4Stack", "true"); 这条线。