Spring Boot Actuator 应用程序无法在 Ubuntu VPS 上启动

Posted

技术标签:

【中文标题】Spring Boot Actuator 应用程序无法在 Ubuntu VPS 上启动【英文标题】:Spring Boot Actuator application won't start on Ubuntu VPS 【发布时间】:2014-10-28 22:23:13 【问题描述】:

我有一个使用 Spring Boot Actuator 的 Java 后端,但它不会在 Digitalocean Ubuntu VPS 上启动。 相同的应用程序在我的 Mac 和另一台 Ubuntu PC 上运行良好。

szabolcs@SmartUpProd:~/smartup$ java -Xmx1536m -jar build/libs/smartup-backend-0.1.0.jar 

它开始初始化,但每次都在同一点停止(没有例外,只是挂起)。如果我此时尝试使用^C 阻止它,它不会带回外壳。

这是输出:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.1.5.RELEASE)

2014-09-04 04:19:27.697  INFO 1724 --- [           main] com.smartup.SmartUpConfiguration         : Starting SmartUpConfiguration on SmartUpProd with PID 1724 (/home/szabolcs/smartup/build/libs/smartup-backend-0.1.0.jar started by szabolcs in /home/szabolcs/smartup)
2014-09-04 04:19:27.783  INFO 1724 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@464e53bb: startup date [Thu Sep 04 04:19:27 EDT 2014]; root of context hierarchy
2014-09-04 04:19:28.911  INFO 1724 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'beanNameViewResolver': 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]]
2014-09-04 04:19:30.225  INFO 1724 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'smartUpConfiguration' of type [class com.smartup.SmartUpConfiguration$$EnhancerBySpringCGLIB$$ec37524d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-09-04 04:19:30.254  INFO 1724 --- [           main] o.s.j.d.DriverManagerDataSource          : Loaded JDBC driver: com.mysql.jdbc.Driver
2014-09-04 04:19:30.266  INFO 1724 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'dataSource' of type [class org.springframework.jdbc.datasource.DriverManagerDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-09-04 04:19:30.293  INFO 1724 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2014-09-04 04:19:30.440  INFO 1724 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations 4.0.1.Final
2014-09-04 04:19:30.452  INFO 1724 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core 4.0.1.Final
2014-09-04 04:19:30.457  INFO 1724 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2014-09-04 04:19:30.459  INFO 1724 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2014-09-04 04:19:30.486  INFO 1724 --- [           main] org.hibernate.ejb.Ejb3Configuration      : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2014-09-04 04:19:30.826  INFO 1724 --- [           main] o.h.s.j.c.i.ConnectionProviderInitiator  : HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
2014-09-04 04:19:31.175  INFO 1724 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2014-09-04 04:19:31.188  INFO 1724 --- [           main] o.h.e.jdbc.internal.LobCreatorBuilder    : HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
2014-09-04 04:19:31.208  INFO 1724 --- [           main] o.h.e.t.i.TransactionFactoryInitiator    : HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
2014-09-04 04:19:31.218  INFO 1724 --- [           main] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
2014-09-04 04:19:31.657  INFO 1724 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000228: Running hbm2ddl schema update

[...]
2014-09-04 04:19:31.768  INFO 1724 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000232: Schema update complete
2014-09-04 04:19:31.947  INFO 1724 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'entityManagerFactory' of type [class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-09-04 04:19:32.092  INFO 1724 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$7460673f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-09-04 04:19:32.119  INFO 1724 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-09-04 04:19:32.148  INFO 1724 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-09-04 04:19:32.167  INFO 1724 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-09-04 04:19:32.574  INFO 1724 --- [           main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080
2014-09-04 04:19:32.803  INFO 1724 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2014-09-04 04:19:32.805  INFO 1724 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/7.0.54
2014-09-04 04:19:32.956  INFO 1724 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2014-09-04 04:19:32.957  INFO 1724 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5178 ms
2014-09-04 04:19:35.202  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/css/**'], []
2014-09-04 04:19:35.203  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/js/**'], []
2014-09-04 04:19:35.203  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/images/**'], []
2014-09-04 04:19:35.203  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/**/favicon.ico'], []
2014-09-04 04:19:35.203  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/info'], []
2014-09-04 04:19:35.203  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/health'], []
2014-09-04 04:19:35.203  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/error'], []
2014-09-04 04:19:35.252  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@5c4b8904, org.springframework.security.web.context.SecurityContextPersistenceFilter@36b59af2, org.springframework.security.web.header.HeaderWriterFilter@71880af1, org.springframework.security.web.authentication.logout.LogoutFilter@1cd26cc7, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@10e5d335, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6c2a1c3a, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@5c58c840, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@166e5d45, org.springframework.security.web.session.SessionManagementFilter@49040d09, org.springframework.security.web.access.ExceptionTranslationFilter@2d18c028, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@5dc9dca8]
2014-09-04 04:19:35.257  INFO 1724 --- [ost-startStop-1] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/dump'], Ant [pattern='/dump/'], Ant [pattern='/dump.*'], Ant [pattern='/env'], Ant [pattern='/env/'], Ant [pattern='/env.*'], Ant [pattern='/configprops'], Ant [pattern='/configprops/'], Ant [pattern='/configprops.*'], Ant [pattern='/autoconfig'], Ant [pattern='/autoconfig/'], Ant [pattern='/autoconfig.*'], Ant [pattern='/mappings'], Ant [pattern='/mappings/'], Ant [pattern='/mappings.*'], Ant [pattern='/trace'], Ant [pattern='/trace/'], Ant [pattern='/trace.*'], Ant [pattern='/metrics'], Ant [pattern='/metrics/'], Ant [pattern='/metrics.*'], Ant [pattern='/beans'], Ant [pattern='/beans/'], Ant [pattern='/beans.*']]], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@73762e60, org.springframework.security.web.context.SecurityContextPersistenceFilter@3d8b310e, org.springframework.security.web.header.HeaderWriterFilter@5ef9f4c9, org.springframework.security.web.authentication.logout.LogoutFilter@2fa7040e, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@3ae20f72, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1bd98f6, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@10736bb4, org.springframework.security.web.session.SessionManagementFilter@4bde96b2, org.springframework.security.web.access.ExceptionTranslationFilter@56ed5cfd, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2df2e9b6]
2014-09-04 04:19:35.391  INFO 1724 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2014-09-04 04:19:35.395  INFO 1724 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'metricFilter' to: [/*]
2014-09-04 04:19:35.396  INFO 1724 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'springSecurityFilterChain' to: [/*]
2014-09-04 04:19:35.396  INFO 1724 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2014-09-04 04:19:35.396  INFO 1724 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'applicationContextIdFilter' to: [/*]
2014-09-04 04:19:35.396  INFO 1724 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'webRequestLoggingFilter' to: [/*]

这是^C之后的输出:

^C2014-09-04 04:34:46.560  INFO 1724 --- [       Thread-2] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@464e53bb: startup date [Thu Sep 04 04:19:27 EDT 2014]; root of context hierarchy
2014-09-04 04:34:46.573  WARN 1724 --- [       Thread-2] ationConfigEmbeddedWebApplicationContext : Exception thrown from LifecycleProcessor on context close

java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@464e53bb: startup date [Thu Sep 04 04:19:27 EDT 2014]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:359)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:888)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:152)
    at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:809)

2014-09-04 04:34:46.601  INFO 1724 --- [       Thread-2] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

有人遇到过同样的问题吗?你们能帮帮我吗?

这里有线程转储(当它挂起时):

szabolcs@SmartUpProd:~$ jstack 2616
2014-09-04 07:33:30
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.20-b23 mixed mode):

"Attach Listener" #14 daemon prio=9 os_prio=0 tid=0x00007fb678001000 nid=0xaae waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"localhost-startStop-1" #13 daemon prio=5 os_prio=0 tid=0x00007fb65000d000 nid=0xa46 runnable [0x00007fb662fec000]
   java.lang.Thread.State: RUNNABLE
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:246)
    at sun.security.provider.SeedGenerator$URLSeedGenerator.getSeedBytes(SeedGenerator.java:539)
    at sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:144)
    at sun.security.provider.SecureRandom$SeederHolder.<clinit>(SecureRandom.java:192)
    at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:210)
    - locked <0x00000000f15173a0> (a sun.security.provider.SecureRandom)
    at java.security.SecureRandom.nextBytes(SecureRandom.java:457)
    - locked <0x00000000f15176c0> (a java.security.SecureRandom)
    at java.security.SecureRandom.next(SecureRandom.java:480)
    at java.util.Random.nextInt(Random.java:329)
    at org.apache.catalina.util.SessionIdGenerator.createSecureRandom(SessionIdGenerator.java:246)
    at org.apache.catalina.util.SessionIdGenerator.getRandomBytes(SessionIdGenerator.java:183)
    at org.apache.catalina.util.SessionIdGenerator.generateSessionId(SessionIdGenerator.java:153)
    at org.apache.catalina.session.ManagerBase.startInternal(ManagerBase.java:573)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:485)
    - locked <0x00000000f1395fc0> (a org.apache.catalina.session.StandardManager)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    - locked <0x00000000f1395fc0> (a org.apache.catalina.session.StandardManager)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5476)
    - locked <0x00000000f675e1a8> (a org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    - locked <0x00000000f675e1a8> (a org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

"Tomcat-startStop-1" #12 daemon prio=5 os_prio=0 tid=0x00007fb65f35b000 nid=0xa45 waiting on condition [0x00007fb6801d8000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000000f675e178> (a java.util.concurrent.FutureTask)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
    at java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    - locked <0x00000000f6705460> (a org.apache.catalina.core.StandardHost)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
    - locked <0x00000000f6705460> (a org.apache.catalina.core.StandardHost)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    - locked <0x00000000f6705460> (a org.apache.catalina.core.StandardHost)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

"DestroyJavaVM" #10 prio=5 os_prio=0 tid=0x00007fb6a0009800 nid=0xa39 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"main" #9 prio=5 os_prio=0 tid=0x00007fb6a01cf800 nid=0xa44 waiting on condition [0x00007fb6808ef000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000000f6705430> (a java.util.concurrent.FutureTask)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
    at java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    - locked <0x00000000f675c598> (a org.apache.catalina.core.StandardEngine)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
    - locked <0x00000000f675c598> (a org.apache.catalina.core.StandardEngine)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    - locked <0x00000000f675c598> (a org.apache.catalina.core.StandardEngine)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    - locked <0x00000000f675c598> (a org.apache.catalina.core.StandardEngine)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    - locked <0x00000000f675bc98> (a org.apache.catalina.core.StandardService)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731)
    - locked <0x00000000f675c340> (a [Lorg.apache.catalina.Service;)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    - locked <0x00000000f675bd68> (a org.apache.catalina.core.StandardServer)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:85)
    - locked <0x00000000f6bbad18> (a org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:74)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:289)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:146)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:159)
    - locked <0x00000000a0d8f098> (a org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
    - locked <0x00000000a0d8f2c8> (a java.lang.Object)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
    at com.smartup.SmartUpConfiguration.main(SmartUpConfiguration.java:78)
    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)

"Service Thread" #7 daemon prio=9 os_prio=0 tid=0x00007fb6a0152000 nid=0xa42 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C1 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007fb6a0132800 nid=0xa41 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007fb6a012f800 nid=0xa40 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x00007fb6a012d800 nid=0xa3f runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007fb6a00ff000 nid=0xa3e in Object.wait() [0x00007fb69041e000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x00000000a0487660> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:142)
    - locked <0x00000000a0487660> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:158)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007fb6a00fd000 nid=0xa3d in Object.wait() [0x00007fb69051f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x00000000a04876a0> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:502)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:157)
    - locked <0x00000000a04876a0> (a java.lang.ref.Reference$Lock)

"VM Thread" os_prio=0 tid=0x00007fb6a00f6000 nid=0xa3c runnable 

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007fb6a001f000 nid=0xa3a runnable 

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00007fb6a0020800 nid=0xa3b runnable 

"VM Periodic Task Thread" os_prio=0 tid=0x00007fb6a0154000 nid=0xa43 waiting on condition 

JNI global references: 48

【问题讨论】:

你可以发布一个线程转储,当它看起来被挂起时? 我已经用线程转储更新了问题。 【参考方案1】:

localhost-startStop-1 正在尝试创建 SecureRandom 的新实例,但在尝试从熵源读取数据时卡住了。这通常是因为源已耗尽。默认熵源是/dev/random。它被称为阻塞源,因为当尝试读取随机数据并且没有可用数据时它会阻塞。 Linux 上的另一个来源是/dev/urandom。与/dev/random 相比,它的主要优点是它是非阻塞的。关于使用/dev/urandom 是否会降低安全性存在一些争论。 This article 可能感兴趣。

总之,使用/dev/urandom 将避免您遇到的问题,但可能会降低安全性。您可以通过系统属性将 Spring Boot 的嵌入式 Tomcat 实例配置为使用 /dev/urandom

-Djava.security.egd=file:/dev/./urandom

【讨论】:

我现在看到了问题的根源,我安装了haveged,现在我有了/dev/random 熵源。非常感谢! 你拯救了我的一天!只是给其他人的注释:额外的./ 是bugs.openjdk.java.net/browse/JDK-6202721 的解决方法 天哪,如果没有光荣的互联网,我不可能找到这个。感谢您拯救我的周末。 这节省了我的周末!很棒的发现。【参考方案2】:

接受的答案对我不起作用。所以我找到了这个答案:

Spring-boot application wont boot at startup inside docker

apt-get install haveged -y

【讨论】:

非常感谢!它帮助了我! 非常感谢。经过几天的头痛,这终于解决了我的问题。 你拯救了我的一天。非常感谢。 接受的答案对我也不起作用,非常感谢

以上是关于Spring Boot Actuator 应用程序无法在 Ubuntu VPS 上启动的主要内容,如果未能解决你的问题,请参考以下文章

使用Actuator 实现Spring Boot应用监控

Spring Boot参考教程内部应用监控(Actuator)

Spring Boot -- actuator

Spring Boot 2.x Actuator

Spring boot 和 Spring Actuator - 禁用安全性

Spring Boot (27) actuator服务监控与管理