spring-guides / gs-spring-boot

Building an Application with Spring Boot :: Learn how to build an application with minimal configuration.
https://spring.io/guides/gs/spring-boot/
Apache License 2.0
890 stars 4.51k forks source link

Sample not working with jetty... #10

Closed johnykov closed 10 years ago

johnykov commented 10 years ago

Hi I have a problem to run this sample app as it is shown in tutorial... it immediately quits.

jan@jan-work ~/3party/gs-spring-boot $ java -jar build/libs/gs-spring-boot-0.1.0.jar

. _ /\ / **' () \ \ \ \ ( ( )** | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |_| .**|| ||| |**, | / / / / =========||==============|_/=///_/ :: Spring Boot :: (v1.0.0.RC4)

2014-03-12 09:06:08.842 INFO 5395 --- [ main] hello.Application : Starting Application on jan-work with PID 5395 (/home/jan/3party/gs-spring-boot/build/libs/gs-spring-boot-0.1.0.jar started by jan) 2014-03-12 09:06:08.928 INFO 5395 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@5502f00c: startup date [Wed Mar 12 09:06:08 CET 2014]; root of context hierarchy 2014-03-12 09:06:10.410 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Registering beans for JMX exposure on startup 2014-03-12 09:06:10.873 INFO 5395 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2014-03-12 09:06:10.875 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'requestMappingEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=requestMappingEndpoint] 2014-03-12 09:06:10.963 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'environmentEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=environmentEndpoint] 2014-03-12 09:06:10.981 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'healthEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=healthEndpoint] 2014-03-12 09:06:10.993 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'beansEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=beansEndpoint] 2014-03-12 09:06:11.008 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'infoEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=infoEndpoint] 2014-03-12 09:06:11.020 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'metricsEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=metricsEndpoint] 2014-03-12 09:06:11.032 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'traceEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=traceEndpoint] 2014-03-12 09:06:11.042 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'dumpEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=dumpEndpoint] 2014-03-12 09:06:11.059 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'autoConfigurationAuditEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=autoConfigurationAuditEndpoint] 2014-03-12 09:06:11.072 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'shutdownEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=shutdownEndpoint] 2014-03-12 09:06:11.099 INFO 5395 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'configurationPropertiesReportEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=configurationPropertiesReportEndpoint] 2014-03-12 09:06:11.113 INFO 5395 --- [ main] hello.Application : Started Application in 2.83 seconds (JVM running for 3.559) Let's inspect the beans provided by Spring Boot: application auditEventRepository auditListener autoConfigurationAuditEndpoint beansEndpoint configurationPropertiesReportEndpoint counterService dumpEndpoint endpointMBeanExporter endpoints.jmx.CONFIGURATION_PROPERTIES environmentEndpoint gaugeService healthEndpoint helloController http.mappers.CONFIGURATION_PROPERTIES infoEndpoint jacksonObjectMapper managementServerProperties mappingJackson2HttpMessageConverter messageConverters messageSource metricRepository metricsEndpoint org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration$AuditEventRepositoryConfiguration org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration$InfoPropertiesConfiguration org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration$RequestMappingEndpointConfiguration org.springframework.boot.actuate.autoconfigure.EndpointMBeanExportAutoConfiguration org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration$MetricRepositoryConfiguration org.springframework.boot.actuate.autoconfigure.TraceRepositoryAutoConfiguration org.springframework.boot.autoconfigure.AutoConfigurationPackages org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$ObjectMappers org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor org.springframework.context.annotation.internalAutowiredAnnotationProcessor org.springframework.context.annotation.internalCommonAnnotationProcessor org.springframework.context.annotation.internalConfigurationAnnotationProcessor org.springframework.context.annotation.internalRequiredAnnotationProcessor propertySourcesPlaceholderConfigurer requestMappingEndpoint shutdownEndpoint traceEndpoint traceRepository 2014-03-12 09:06:11.118 INFO 5395 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@5502f00c: startup date [Wed Mar 12 09:06:08 CET 2014]; root of context hierarchy 2014-03-12 09:06:11.120 INFO 5395 --- [ Thread-2] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0 2014-03-12 09:06:11.124 INFO 5395 --- [ Thread-2] o.s.b.a.e.jmx.EndpointMBeanExporter : Unregistering JMX-exposed beans on shutdown

My config is: gradle -v


Gradle 1.11

Build time: 2014-02-11 11:34:39 UTC Build number: none Revision: a831fa866d46cbee94e61a09af15f9dd95987421

Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013 Ivy: 2.2.0 JVM: 1.7.0_45 (Oracle Corporation 24.45-b08) OS: Linux 3.8.0-33-generic amd64

What is strange it works being "run" from idea intelij... and when I run it on tomcat it also runs

gregturn commented 10 years ago

@philwebb This situation only happens with the runnable JAR via spring-boot-gradle plugin. mvn spring-boot:run, java -jar target/gs-spring-boot-0.1.0.jar, and ./gradlew clean bootRun work fine with jetty and it stays up. Makes me wonder what might be happening to trip up jetty.

gregturn commented 10 years ago

Resolved with #11