Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

java - Spring Boot Actuator application won't start on Ubuntu VPS

I have a Java backend which uses Spring Boot Actuator but it won't start on Digitalocean Ubuntu VPS. The same application runs well on my Mac and on an other Ubuntu PC.

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

It starts the initialisation but it stops at the same point every time (no exception, just hangs). If I try to stop it at this point with ^C it won't bring the shell back.

This is the outoput:

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _    
( ( )\___ | '_ | '_| | '_ / _` |    
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: 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 172

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

localhost-startStop-1 is trying to create a new instance of SecureRandom and it's stuck trying to read data from an entropy source. This typically occurs because the source has been depleted. The default entropy source is /dev/random. It's known as a blocking source as it will block when an attempt is made to read random data and none is available. Another source on Linux is /dev/urandom. Its main benefit over /dev/random is that it's non-blocking. There's some debate over whether or not using /dev/urandom will make things less secure. This article may be of interest.

In summary, using /dev/urandom will avoid the problem you're seeing, at the possible cost of decreased security. You can configure Spring Boot's embedded Tomcat instance to use /dev/urandom via a system property:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...