新建springboot 微服务项目启动时,自动停止,控制台无异常信息。
控制台输出如下:
"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:63102,suspend=y,server=n -
. ___ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.4.RELEASE)
2019-05-08 19:25:01.262 INFO 3632 --- [ main] c.w.e.EurekaClient1Application : No active profile set, falling back to default profiles: default
2019-05-08 19:25:01.613 INFO 3632 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=0d219a11-7035-3533-aea0-ef2facd42dd4
2019-05-08 19:25:01.658 INFO 3632 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$36c2428e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-08 19:25:01.673 WARN 3632 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-05-08 19:25:01.673 INFO 3632 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-05-08 19:25:01.678 WARN 3632 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-05-08 19:25:01.678 INFO 3632 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-05-08 19:25:02.232 INFO 3632 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-05-08 19:25:02.273 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-05-08 19:25:02.660 INFO 3632 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-05-08 19:25:02.660 INFO 3632 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-05-08 19:25:02.801 INFO 3632 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-05-08 19:25:02.802 INFO 3632 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-05-08 19:25:03.029 INFO 3632 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-05-08 19:25:03.113 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-05-08 19:25:03.113 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-05-08 19:25:03.113 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-05-08 19:25:03.113 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-05-08 19:25:03.113 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-05-08 19:25:03.113 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-05-08 19:25:03.113 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-05-08 19:25:03.321 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-05-08 19:25:03.325 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-05-08 19:25:03.328 INFO 3632 --- [ main] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-05-08 19:25:03.332 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1557314703330 with initial instances count: 3
2019-05-08 19:25:03.333 INFO 3632 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application EUREKA-CLIENT1 with eureka with status UP
2019-05-08 19:25:03.333 INFO 3632 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1557314703333, current=UP, previous=STARTING]
2019-05-08 19:25:03.335 INFO 3632 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-CLIENT1/DESKTOP-56P90GC:eureka-client1:8010: registering service...
2019-05-08 19:25:03.345 INFO 3632 --- [ main] c.w.e.EurekaClient1Application : Started EurekaClient1Application in 3.51 seconds (JVM running for 4.498)
2019-05-08 19:25:03.348 INFO 3632 --- [ Thread-12] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application EUREKA-CLIENT1 with eureka with status DOWN
2019-05-08 19:25:03.348 WARN 3632 --- [ Thread-12] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1557314703348, current=DOWN, previous=UP]
2019-05-08 19:25:03.352 INFO 3632 --- [ Thread-12] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-05-08 19:25:03.368 INFO 3632 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-CLIENT1/DESKTOP-56P90GC:eureka-client1:8010 - registration status: 204
2019-05-08 19:25:03.369 INFO 3632 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-CLIENT1/DESKTOP-56P90GC:eureka-client1:8010: registering service...
2019-05-08 19:25:03.373 INFO 3632 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-CLIENT1/DESKTOP-56P90GC:eureka-client1:8010 - registration status: 204
2019-05-08 19:25:03.375 INFO 3632 --- [ Thread-12] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-05-08 19:25:03.380 INFO 3632 --- [ Thread-12] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-CLIENT1/DESKTOP-56P90GC:eureka-client1:8010 - deregister status: 200
2019-05-08 19:25:03.386 INFO 3632 --- [ Thread-12] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
Disconnected from the target VM, address: '127.0.0.1:63102', transport: 'socket'
Process finished with exit code 0
无任何异常信息,springboot 自动停止。
解决办法:pom文件加入 web 架包。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
原因:控制台中有这样一段输出:
2019-05-08 19:25:03.348 INFO 3632 --- [ Thread-12] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application EUREKA-CLIENT1 with eureka with status DOWN
java项目启动不需要容器,但是springCloud项目都是web项目,所以需要容器才能启动。