关于spring boot 启动参数启动的问题

扫一扫体验手机阅读
Spring Boot 为什么这么火?
<span type="1" blog_id="2137192" userid='
3篇文章,610人气,0粉丝
心若向阳,何惧忧伤
大数据时代的微服务之路
¥51.00488人订阅
<span type="1" blog_id="2137192" userid='spring boot在启动项目之后执行的实现方法
转载 &更新时间:日 11:16:18 & 作者:Tomoya
在开发时有时候需要在整个应用开始运行时执行一些特定代码,比如初始化环境,下面这篇文章就来给大家介绍了关于spring boot在启动项目之后执行自己要执行的东西的实现方法,文中给出了详细的示例代码,需要的朋友可以参考下。
我们在web项目启动之后有时候还会做点其它的东西(比如,导入数据脚本),下面就说说spring-boot里怎么在程序启动后加入自己要执行的东西
方法如下:
新建一个类:BeforeStartup.java
@Configuration
public class BeforeStartup implements ApplicationListener&ContextRefreshedEvent& {
@Autowired
private InitDB initDB;
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
initDB.createUser();
InitDB.java
@Component
public class InitDB {
Logger log = Logger.getLogger(MyInvocationSecurityMetadataSource.class);
@Autowired
private UserService userS
// create user
public void createUser() {
User user = new User();
user.setAvatar("aaa");
user.setBlock(false);
user.setEmail("aaa");
user.setInTime(new Date());
user.setPassword("1111");
user.setSignature("1111");
user.setUrl("222");
user.setUsername("bb");
userService.save(user);
再配合一个变量记录系统是否初始化过,如果初始化了,就不再初始化了,这样就可以做到启动系统之后再自动将默认数据插入,很是方便
相关代码参见:https://github.com/tomoya92/pybbs
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对脚本之家的支持。
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具&&&&& 这次用了spring boot,项目在启动时报错,由于我用的是jdk 1.7 ,该项目默认的是jdk 1.8,所以要把下面这一系列配置改好才行。废话不多说,上图:
&&& 一看发现,项目环境没有配全,打开file-》Project Structuer,找到Project ,把里面的jdk配置成你自己的。
&&&& 还有Modules里面的的这几项:
&&&&& 然后找到file-》setting--》Java Compiler 里面
这些都配置好才能起动main函数启动服务。
阅读(...) 评论()先做好写代码这事
Spring Boot几种启动问题的解决方案
使用Spring Boot以来,遇到和解决过好几次不同的项目启动问题,大多数事故起于错误的配置和依赖。因此,本文用于汇总这些问题,以及提供相应的解决方案,帮助大家更快的定位和排除故障。1. Unregistering JMX-exposed beans on shutdown
项目中没有添加spring-boot-starter-web模块依赖,在启动 Application 运行过程中会出现这个错误。
/\\ / ___'_ __ _ _(_)_ __
__ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
___)| |_)| | | | | || (_| |
|____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::
(v1.5.11.RELEASE)
18:32:49.445
INFO 33160 --- [
main] cn.mariojd.demo.DemoApplication
: Starting DemoApplication on Mario with PID 33160 (started by jd in D:\IntelliJ IDEA\projects\test)
18:32:49.451
INFO 33160 --- [
main] cn.mariojd.demo.DemoApplication
: No active profile set, falling back to default profiles: default
18:32:49.542
INFO 33160 --- [
main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@: startup date [Wed May 02 18:32:49 CST 2018]; root of context hierarchy
18:32:50.115
INFO 33160 --- [
main] o.s.j.e.a.AnnotationMBeanExporter
: Registering beans for JMX exposure on startup
18:32:50.128
INFO 33160 --- [
main] cn.mariojd.demo.DemoApplication
: Started DemoApplication in 1.01 seconds (JVM running for 1.83)
... end SpringApplication.run()
18:32:50.129
INFO 33160 --- [
Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@: startup date [Wed May 02 18:32:49 CST 2018]; root of context hierarchy
18:32:50.130
INFO 33160 --- [
Thread-2] o.s.j.e.a.AnnotationMBeanExporter
: Unregistering JMX-exposed beans on shutdown
解决方案,引入spring-boot-starter-web模块
&dependency&
&groupId&org.springframework.boot&/groupId&
&artifactId&spring-boot-starter-web&/artifactId&
&/dependency&
网上大多数的解决方案是通过添加spring-boot-starter-tomcat依赖来解决,但实测证明此方法不可行。2. Cannot determine embedded database driver class for database type NONE
项目中添加了spring-boot-starter-data-jpa模块依赖,而且没有配置数据源连接信息的情况下,启动 Application 过程中会出现该错误,原因是Spring Boot在启动时会自动注入数据源和配置JPA。
/\\ / ___'_ __ _ _(_)_ __
__ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
___)| |_)| | | | | || (_| |
|____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::
(v1.5.11.RELEASE)
19:49:13.640
INFO 37652 --- [
main] cn.mariojd.demo.DemoApplication
: Starting DemoApplication on Mario with PID 37652 (started by jd in D:\IntelliJ IDEA\projects\test)
19:49:13.643
INFO 37652 --- [
main] cn.mariojd.demo.DemoApplication
: No active profile set, falling back to default profiles: default
19:49:13.692
INFO 37652 --- [
main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@62fdb4a6: startup date [Wed May 02 19:49:13 CST 2018]; root of context hierarchy
19:49:15.150
INFO 37652 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$4ad697b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
19:49:15.433
INFO 37652 --- [
main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
19:49:15.460
INFO 37652 --- [
main] o.apache.catalina.core.StandardService
: Starting service [Tomcat]
19:49:15.461
INFO 37652 --- [
main] org.apache.catalina.core.StandardEngine
: Starting Servlet Engine: Apache Tomcat/8.5.29
19:49:15.564
INFO 37652 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]
: Initializing Spring embedded WebApplicationContext
19:49:15.564
INFO 37652 --- [ost-startStop-1] o.s.web.context.ContextLoader
: Root WebApplicationContext: initialization completed in 1876 ms
19:49:15.679
INFO 37652 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean
: Mapping servlet: 'dispatcherServlet' to [/]
19:49:15.682
INFO 37652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter: 'characterEncodingFilter' to: [/*]
19:49:15.682
INFO 37652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
19:49:15.682
INFO 37652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter: 'httpPutFormContentFilter' to: [/*]
19:49:15.683
INFO 37652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter: 'requestContextFilter' to: [/*]
19:49:15.717
WARN 37652 --- [
main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via f nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
19:49:15.719
INFO 37652 --- [
main] o.apache.catalina.core.StandardService
: Stopping service [Tomcat]
19:49:15.765
INFO 37652 --- [
main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
19:49:15.791 ERROR 37652 --- [
main] o.s.b.d.LoggingFailureAnalysisReporter
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Process finished with exit code 1
解决方案1,移除spring-boot-starter-data-jpa模块依赖;解决方案2,将启动类注解@SpringBootApplication修改如下;@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
解决方案3,在配置文件中添加数据库连接信息。spring:
datasource:
username: xxx
password: xxx
没有更多推荐了,发布于 07/10 09:43
09:03:22.857
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource systemProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
09:03:22.857
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource systemEnvironment [org.springframework.core.env.SystemEnvironmentPropertySource] to EncryptableMapPropertySourceWrapper
09:03:22.857
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource random [org.springframework.boot.context.config.RandomValuePropertySource] to EncryptablePropertySourceWrapper
09:03:22.857
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource applicationConfig: [classpath:/application.properties] [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper
09:03:22.857
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource springCloudClientHostInfo [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
09:03:22.858
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource defaultProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
09:03:22.862
INFO [lovego-perception,,,] 1 --- [
main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
09:03:22.952
INFO [lovego-perception,,,] 1 --- [
main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
09:03:23.056
INFO [lovego-perception,,,] 1 --- [
main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
09:03:23.272
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.kafka.annotation.KafkaBootstrapConfiguration' of type [class org.springframework.kafka.annotation.KafkaBootstrapConfiguration$$EnhancerBySpringCGLIB$$b9567802] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:23.655
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport' of type [class org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport$$EnhancerBySpringCGLIB$$22e60442] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:24.262
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$e5a4667f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:26.758
INFO [lovego-perception,,,] 1 --- [
main] o.s.b.f.config.PropertiesFactoryBean
: Loading properties file from URL [jar:file:/application/lovego-perception.jar!/BOOT-INF/lib/spring-integration-core-4.3.5.RELEASE.jar!/META-INF/spring.integration.default.properties]
09:03:26.759
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationGlobalProperties' of type [class org.springframework.beans.factory.config.PropertiesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:26.865
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationGlobalProperties' of type [class java.util.Properties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:27.851
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$1be697c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:28.072
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration' of type [class org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration$$EnhancerBySpringCGLIB$$25363f45] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:28.179
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignClientAutoConfiguration' of type [class org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignClientAutoConfiguration$$EnhancerBySpringCGLIB$$1b97de84] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:28.463
INFO [lovego-perception,,,] 1 --- [
main] trationDelegate$BeanPostProcessorChecker : Bean 'traceFeignObjectWrapper' of type [class org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignObjectWrapper] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:03:30.855
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.r.DefaultLazyPropertyResolver
: Property Resolver custom Bean not found with name 'encryptablePropertyResolver'. Initializing Default Property Resolver
09:03:30.860
INFO [lovego-perception,,,] 1 --- [
main] c.u.j.d.DefaultLazyPropertyDetector
: Property Detector custom Bean not found with name 'encryptablePropertyDetector'. Initializing Default Property Detector
09:03:34.162
INFO [lovego-perception,,,] 1 --- [
main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 9017 (http)
09:03:34.266
INFO [lovego-perception,,,] 1 --- [
main] o.apache.catalina.core.StandardService
: Starting service Tomcat
09:03:34.268
INFO [lovego-perception,,,] 1 --- [
main] org.apache.catalina.core.StandardEngine
: Starting Servlet Engine: Apache Tomcat/8.5.6
09:03:34.768 ERROR [lovego-perception,,,] 1 --- [cat-startStop-1] org.apache.catalina.core.ContainerBase
: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_152]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_152]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:911) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:890) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_152]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_152]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [Pipeline[StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5099) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.authenticator.NonLoginAuthenticator[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:170) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 8 common frames omitted
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/S
at org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1125) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 10 common frames omitted
09:03:34.770 ERROR [lovego-perception,,,] 1 --- [
main] org.apache.catalina.core.ContainerBase
: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_152]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_152]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:911) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:791) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:356) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:96) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.&init&(TomcatEmbeddedServletContainer.java:82) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:535) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:177) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at com.lovego.cloud.perception.configuration.MyEmbeddedServletContainerFactory.getEmbeddedServletContainer(MyEmbeddedServletContainerFactory.java:17) [classes!/:0.0.1-SNAPSHOT]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) [spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at com.lovego.cloud.perception.LovegoPerceptionApplication.main(LovegoPerceptionApplication.java:17) [classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [lovego-perception.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [lovego-perception.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [lovego-perception.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [lovego-perception.jar:0.0.1-SNAPSHOT]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_152]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_152]
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:890) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 6 common frames omitted
09:03:34.771
WARN [lovego-perception,,,] 1 --- [
main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to star nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
09:03:34.859 ERROR [lovego-perception,,,] 1 --- [
main] o.s.boot.SpringApplication
: Application startup failed
org.springframework.context.ApplicationContextException: Unable to star nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) ~[spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at com.lovego.cloud.perception.LovegoPerceptionApplication.main(LovegoPerceptionApplication.java:17) [classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [lovego-perception.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [lovego-perception.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [lovego-perception.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [lovego-perception.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:115) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.&init&(TomcatEmbeddedServletContainer.java:82) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:535) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:177) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at com.lovego.cloud.perception.configuration.MyEmbeddedServletContainerFactory.getEmbeddedServletContainer(MyEmbeddedServletContainerFactory.java:17) ~[classes!/:0.0.1-SNAPSHOT]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
... 16 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:356) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:96) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
... 22 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:791) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 24 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 26 common frames omitted
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.5.6.jar!/:8.5.6]
... 28 common frames omitted
&dependency&
&groupId&org.apache.mahout&/groupId&
&artifactId&mahout-integration&/artifactId&
&version&0.8&/version&
&exclusions&
&exclusion&
&groupId&org.apache.lucene&/groupId&
&artifactId&lucene-analyzers-common&/artifactId&
&/exclusion&
&exclusion&
&groupId&org.apache.lucene&/groupId&
&artifactId&lucene-core&/artifactId&
&/exclusion&
&exclusion&
&groupId&org.apache.lucene&/groupId&
&artifactId&lucene-benchmark&/artifactId&
&/exclusion&
&/exclusions&
&exclusions&
&exclusion&
&groupId&org.mortbay.jetty&/groupId&
&artifactId&jetty&/artifactId&
&/exclusion&
&/exclusions&
&/dependency&
包含jetty,jar,注释掉就可以了
& 著作权归作者所有
人打赏支持
码字总数 140043
1、应用服务基路径问题 这个问题应该是Spring Boot 2.0升级带来的,既然遇到了,就在这里写一写。笔者在授权服务器想设置一个统一基路径,按照Spring Boot 1.0,是这样的: 但是升级之后并不...
基于spring boot打成工具jar包依赖无法使用问题 分析jar结构如下图 发现多了个BOOT-INF目录结构,此结构正是spring boot 运行包结构,其他包或者项目是无法通过maven依赖直接使用里面的功能(...
先给大家晒一下云收藏的几个数据,作为一个 Spring Boot 的开源项目(https://github.com/cloudfavorites/favorites-web)目前在 Github 上面已经有1600多个 Star,如果按照 SpringBoot 标签...
SOFABoot 是蚂蚁金服开源的基于 Spring Boot 的研发框架,它在 Spring Boot 的基础上,提供了诸如 Readiness Check,类隔离,日志空间隔离等等能力。在增强了 Spring Boot 的同时,SOFABoot ...
微服务架构 微服务的诞生并非偶然,它是在互联网高速发展,技术日新月异的变化以及传统架构无法适应快速变化等多重因素的推动下诞生的产物。互联网时代的产品通常有两类特点:需求变化快和用...
微服务架构 微服务的诞生并非偶然,它是在互联网高速发展,技术日新月异的变化以及传统架构无法适应快速变化等多重因素的推动下诞生的产物。互联网时代的产品通常有两类特点:需求变化快和用...
我知道大家这段时间看了我写关于 docker 相关的几篇文章,不疼不痒的,仍然没有感受 docker 的便利,是的,我也是这样认为的,I know your felling 。 前期了解概念什么的确实比较无聊,请不...
微服务的诞生并非偶然,它是在互联网高速发展,技术日新月异的变化以及传统架构无法适应快速变化等多重因素的推动下诞生的产物。互联网时代的产品通常有两类特点:需求变化快和用户群体庞大,...
java高级架构牛人
spring boot 框架在生产环境使用的有一段时间了,它“约定大于配置”的特性,体现了优雅流畅的开发过程,它的部署启动方式()也很优雅。但是我使用的停止应用的方式是 ,即使写了脚本,还是...
背景 从Servlet技术到Spring和Spring MVC,开发Web应用变得越来越简捷。但是Spring和Spring MVC的众多配置有时却让人望而却步,相信有过Spring MVC开发经验的朋友能深刻体会到这一痛苦。因为...
临江仙卜算子
没有更多内容
加载失败,请刷新页面
上一篇我们介绍了《整合spring cloud云服务架构 - HongHu云架构common-service代码结构分析》,本节我们将对common-service整个项目进行剖析,将整个构建的流程给记录下来,让更多的关注者来...
在使用HttpClient调用后台resetful服务时,“Connection reset”是一个比较常见的问题,有同学跟我私信说被这个问题困扰很久了,今天就来分析下,希望能帮到大家。例如我们线上的网关日志就会...
夜黑人模糊灬
所有的文档标记都是在每一行的 * 后面以@开头。如果在一段话的中间出来@的标记,这个标记将会被当做普通内容而被忽略掉。 @access 该标记用于指明关键字的存取权限:private、public或prote...
PostGis 1.需要安装postgreSQL,postgis作为插件嵌入到postgreSQL中; 2.使用zip包直接安装,需要修改 makepostgisdb_using_extensions.bat文件中的路径,用户名,密码,然后直接运行; 3.没有...
需求:现在有两个任务,任务1和任务2,任务1中有多个线程,并且任务2必须等任务1完成后才能执行。 namespace TThread{
class Program
static void Main(string[] ar...
kaixinguo314
https://blog.csdn.net/weiyuefei/article/details/ 视频: 上传服务,转码服务,视频一致性MD5 视频转码技术及转码实现详解 https://wenku.baidu.com/view/69eae009eda...
序言 单独总结tcpdump抓包的常用命令 主要语法 过滤主机/IP: tcpdump -i eth1 host 172.16.7.206 抓取所有经过网卡1,目的IP为172.16.7.206的网络数据 过滤端口: tcpdump -i eth1 dst port...
Question 274. H-Index Solution 题目大意: 论文里的 h 因子判定,题目的意思可能有点晦涩。h 因子是评判学术成就的一种重要方法,h 因子越高越好,h 因子兼顾研究学术人员的学术产出数量与...
struts2启动时,出现的 Unable to read class [com.mrp.action.BaseAction] java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/finder/DefaultClassFinder$InfoBuildingVisito......
20.27 分发系统介绍 应用场景 企业中随之业务的逐渐增大,后端所使用的编程语言是php,系统为LAMP/LNMP架构,需要将代码上传到服务器中;代码会不断的迭代,这就需要在业务服务器上更新代码,...
没有更多内容
加载失败,请刷新页面
文章删除后无法恢复,确定取消删除此文章吗?
亲,自荐的博客将通过私信方式通知管理员,优秀的博客文章审核通过后将在博客推荐列表中显示
确定推荐此文章吗?
确定推荐此博主吗?
聚合全网技术文章,根据你的阅读喜好进行个性推荐
指定官方社区
深圳市奥思网络科技有限公司版权所有}

我要回帖

更多关于 spring bean生命周期 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信