当前位置: 首页 > 知识库问答 >
问题:

为什么Spring Boot web app启动后会立即关闭?

勾炜
2023-03-14

使用STS,如果我使用最新的Spring Boot导入“REST Service”Getting Starting项目并选择“Run As Spring Boot App”,它将启动,然后立即关闭。

:: Spring Boot ::        (v1.1.1.RELEASE)

2014-06-14 11:08:34.226  INFO 47728 --- [           main] hello.Application                        : Starting Application on localhost with PID 47728 (/Users/pdrummond/src/sts/gs-rest-service-complete/target/classes started by pdrummond in /Users/pdrummond/src/sts/gs-rest-service-complete)
2014-06-14 11:08:34.257  INFO 47728 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@802b249: startup date [Sat Jun 14 11:08:34 BST 2014]; root of context hierarchy
2014-06-14 11:08:34.680  INFO 47728 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2014-06-14 11:08:34.908  INFO 47728 --- [           main] hello.Application                        : Started Application in 0.917 seconds (JVM running for 1.351)
2014-06-14 11:08:36.397  INFO 47728 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@802b249: startup date [Sat Jun 14 11:08:34 BST 2014]; root of context hierarchy
2014-06-14 11:08:36.398  INFO 47728 --- [       Thread-3] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
     :: Spring Boot ::        (v1.1.1.RELEASE)

    2014-06-14 19:29:03.814  INFO 986 --- [           main] hello.Application                        : Starting Application on localhost with PID 986 (/Users/pdrummond/src/sts/gs-rest-service-complete/target/classes started by pdrummond in /Users/pdrummond/src/sts/gs-rest-service-complete)
    2014-06-14 19:29:03.816 DEBUG 986 --- [           main] o.s.boot.SpringApplication               : Loading source class hello.Application
    2014-06-14 19:29:03.838  INFO 986 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@c163956: startup date [Sat Jun 14 19:29:03 BST 2014]; root of context hierarchy
    2014-06-14 19:29:04.177  INFO 986 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    2014-06-14 19:29:04.346 DEBUG 986 --- [           main] utoConfigurationReportLoggingInitializer : 


    =========================
    AUTO-CONFIGURATION REPORT
    =========================


    Positive matches:
    -----------------

       PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer
          - @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) found no beans (OnBeanCondition)

       JacksonAutoConfiguration
          - @ConditionalOnClass classes found: com.fasterxml.jackson.databind.ObjectMapper (OnClassCondition)

       JacksonAutoConfiguration#jacksonObjectMapper
          - @ConditionalOnMissingBean (types: com.fasterxml.jackson.databind.ObjectMapper; SearchStrategy: all) found no beans (OnBeanCondition)

       JmxAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.jmx.export.MBeanExporter (OnClassCondition)
          - SpEL expression on org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration: ${spring.jmx.enabled:true} (OnExpressionCondition)

       JmxAutoConfiguration#mbeanServer
          - @ConditionalOnMissingBean (types: javax.management.MBeanServer; SearchStrategy: all) found no beans (OnBeanCondition)

       JmxAutoConfiguration#objectNamingStrategy
          - @ConditionalOnMissingBean (types: org.springframework.jmx.export.naming.ObjectNamingStrategy; SearchStrategy: all) found no beans (OnBeanCondition)

       HttpMessageConvertersAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.http.converter.HttpMessageConverter (OnClassCondition)

       HttpMessageConvertersAutoConfiguration#messageConverters
          - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.HttpMessageConverters; SearchStrategy: all) found no beans (OnBeanCondition)

       HttpMessageConvertersAutoConfiguration.ObjectMappers
          - @ConditionalOnClass classes found: com.fasterxml.jackson.databind.ObjectMapper (OnClassCondition)

       HttpMessageConvertersAutoConfiguration.ObjectMappers#mappingJackson2HttpMessageConverter
          - @ConditionalOnMissingBean (types: org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; SearchStrategy: all) found no beans (OnBeanCondition)


    Negative matches:
    -----------------

       MessageSourceAutoConfiguration
          - Bundle found for spring.messages.basename: messages (MessageSourceAutoConfiguration.ResourceBundleCondition)

       RabbitAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.amqp.rabbit.core.RabbitTemplate,com.rabbitmq.client.Channel (OnClassCondition)

       AopAutoConfiguration
          - required @ConditionalOnClass classes not found: org.aspectj.lang.annotation.Aspect,org.aspectj.lang.reflect.Advice (OnClassCondition)

       BatchAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.batch.core.launch.JobLauncher,org.springframework.jdbc.core.JdbcOperations (OnClassCondition)

       ElasticsearchRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.repository.ElasticsearchRepository (OnClassCondition)

       JpaRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.data.jpa.repository.JpaRepository (OnClassCondition)

       MongoRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.repository.MongoRepository (OnClassCondition)

       RepositoryRestMvcAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       SolrRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: org.apache.solr.client.solrj.SolrServer,org.springframework.data.solr.repository.SolrRepository (OnClassCondition)

       ElasticsearchAutoConfiguration
          - required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.client.TransportClientFactoryBean,org.springframework.data.elasticsearch.client.NodeClientFactoryBean (OnClassCondition)

       ElasticsearchDataAutoConfiguration
          - required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.core.ElasticsearchTemplate (OnClassCondition)

       FlywayAutoConfiguration
          - required @ConditionalOnClass classes not found: org.flywaydb.core.Flyway (OnClassCondition)

       FreeMarkerAutoConfiguration
          - required @ConditionalOnClass classes not found: freemarker.template.Configuration,org.springframework.ui.freemarker.FreeMarkerConfigurationFactory (OnClassCondition)

       GroovyTemplateAutoConfiguration
          - required @ConditionalOnClass classes not found: groovy.text.TemplateEngine (OnClassCondition)

       HypermediaAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.hateoas.Resource (OnClassCondition)

       IntegrationAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.integration.config.EnableIntegration (OnClassCondition)

       JacksonAutoConfiguration.JodaModuleAutoConfiguration
          - required @ConditionalOnClass classes not found: com.fasterxml.jackson.datatype.joda.JodaModule (OnClassCondition)

       JacksonAutoConfiguration.Jsr310ModuleAutoConfiguration
          - Required JVM version 1.8 or newer found 1.6 (OnJavaCondition)

       DataSourceAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType (OnClassCondition)

       DataSourceTransactionManagerAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionManager (OnClassCondition)

       JmsAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.jms.core.JmsTemplate (OnClassCondition)

       ActiveMQAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.jms.ConnectionFactory,org.apache.activemq.ActiveMQConnectionFactory (OnClassCondition)

       HornetQAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.jms.ConnectionFactory,org.hornetq.api.jms.HornetQJMSClient (OnClassCondition)

       JmxAutoConfiguration#mbeanExporter
          - @ConditionalOnMissingBean (types: org.springframework.jmx.export.MBeanExporter; SearchStrategy: current) found the following [mbeanExporter] (OnBeanCondition)

       LiquibaseAutoConfiguration
          - required @ConditionalOnClass classes not found: liquibase.integration.spring.SpringLiquibase (OnClassCondition)

       DeviceDelegatingViewResolverAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       DeviceResolverAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.mobile.device.DeviceResolverHandlerInterceptor,org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver (OnClassCondition)

       SitePreferenceAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor,org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver (OnClassCondition)

       MongoAutoConfiguration
          - required @ConditionalOnClass classes not found: com.mongodb.Mongo (OnClassCondition)

       MongoDataAutoConfiguration
          - required @ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.core.MongoTemplate (OnClassCondition)

       HibernateJpaAutoConfiguration
          - did not find HibernateEntityManager class (HibernateJpaAutoConfiguration.HibernateEntityManagerCondition)

       ReactorAutoConfiguration
          - required @ConditionalOnClass classes not found: reactor.spring.context.config.EnableReactor (OnClassCondition)

       RedisAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.data.redis.connection.jedis.JedisConnection,org.springframework.data.redis.core.RedisOperations,redis.clients.jedis.Jedis (OnClassCondition)

       FallbackWebSecurityAutoConfiguration
          - SpEL expression on org.springframework.boot.autoconfigure.security.FallbackWebSecurityAutoConfiguration: !${security.basic.enabled:true} (OnExpressionCondition)

       SecurityAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.security.authentication.AuthenticationManager (OnClassCondition)

       FacebookAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.facebook.connect.FacebookConnectionFactory (OnClassCondition)

       LinkedInAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.linkedin.connect.LinkedInConnectionFactory (OnClassCondition)

       SocialWebAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.connect.web.ConnectController,org.springframework.social.config.annotation.SocialConfigurerAdapter (OnClassCondition)

       TwitterAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.twitter.connect.TwitterConnectionFactory (OnClassCondition)

       SolrAutoConfiguration
          - required @ConditionalOnClass classes not found: org.apache.solr.client.solrj.SolrServer (OnClassCondition)

       ThymeleafAutoConfiguration
          - required @ConditionalOnClass classes not found: org.thymeleaf.spring4.SpringTemplateEngine (OnClassCondition)

       VelocityAutoConfiguration
          - required @ConditionalOnClass classes not found: org.apache.velocity.app.VelocityEngine,org.springframework.ui.velocity.VelocityEngineFactory (OnClassCondition)

       DispatcherServletAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       EmbeddedServletContainerAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       ErrorMvcAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet (OnClassCondition)

       MultipartAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.servlet.Servlet,javax.servlet.MultipartConfigElement (OnClassCondition)

       ServerPropertiesAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       WebMvcAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       WebSocketAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.apache.catalina.startup.Tomcat,org.springframework.web.socket.WebSocketHandler,org.apache.tomcat.websocket.server.WsSci (OnClassCondition)



    2014-06-14 19:29:04.348  INFO 986 --- [           main] hello.Application                        : Started Application in 0.73 seconds (JVM running for 1.085)
    2014-06-14 19:29:06.378  INFO 986 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@c163956: startup date [Sat Jun 14 19:29:03 BST 2014]; root of context hierarchy
    2014-06-14 19:29:06.379  INFO 986 --- [       Thread-3] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

共有1个答案

汪理
2023-03-14

我也有同样的问题。为了使其工作,我必须调整pom.xml,注释掉spring-boot-starter-tomcat工件的“提供”范围,并更新依赖项。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <!--<scope>provided</scope>-->
</dependency>

现在它按预期启动!多亏了其他一些让我走上正轨的答案。

 类似资料:
  • 这是我的第一个Spring Boot代码。不幸的是,它总是关机。我原本期望它能持续运行,这样我的web客户端就能从浏览器中获取一些数据。 附注。Build.Gradle是错误。 一旦我用粗体取下上面那一行,一切都正常了。我的应用程序上下文现在是正确的。谢谢戴夫

  • 我正在Windows10 Pro上运行Ubuntu18.04。我已经在Ubuntu上安装了docker。我可以在Ubuntu上看到docker的版本,但我不能在系统上运行docker的hello-world测试容器。每当我键入命令“sudo service docker start”时,它会显示我“*starting docker:docker”,但当我检查服务的状态时,它会显示我“*docker

  • 我已经在我的Ubuntu 16.04上安装了Android Studio 我已经使用AVD设备管理器设置了一个设备 当我尝试启动设备时,模拟器会快速闪烁,然后消失。

  • 问题内容: 我在后台运行一个容器 它迅速退出。但是,如果我在前台运行,则可以正常运行。我使用检查了日志 没有错误。有任何想法吗? DOCKERFILE start-all.sh 问题答案: 一个Docker容器的主要过程完成后退出。 在这种情况下,它将在脚本结束时退出。我对hadoop不太了解,无法在这种情况下告诉您如何做,但是您需要要么在前台运行某些东西,要么使用诸如runit或supervis

  • 我有一个无法调整大小的设置面板,它变得越来越拥挤,所以我决定将包含设置的gridpane添加到滚动窗格中。问题是当应用程序启动时,滚动窗格从底部开始。奇怪的是,我将HValue设置为0,它应该从顶部开始。这是在场景生成器中显示的gif:https://gyazo.com/f10a1641b8357e4fc30cd180c0425dae没有任何代码与scrollpane交互,正如您所看到的,scen