gpt4 book ai didi

java - 如何在没有tomcat的情况下启动jhipster微服务应用程序

转载 作者:太空宇宙 更新时间:2023-11-04 12:14:19 26 4
gpt4 key购买 nike

我创建了一个 jhipster (v3.4.0) 微服务​​应用程序,并希望将其部署在生产环境中,而不是部署在 tomcat 实例上。我已将其配置为不需要 jhipster-registry 或 jhipster-console 来进行日志转发。所以我想要实现的是将其作为 java app/jar 运行。

这是我使用开发配置文件运行它的日志:

hostname:myapp edmond$ ./mvnw 
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Myapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.3.5.RELEASE:run (default-cli) > test-compile @ myapp >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myapp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 43 resources
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-versions) @ myapp ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.6.201602180812:prepare-agent (pre-unit-tests) @ myapp ---
[INFO] surefireArgLine set to -javaagent:/Users/edmond/.m2/repository/org/jacoco/org.jacoco.agent/0.7.6.201602180812/org.jacoco.agent-0.7.6.201602180812-runtime.jar=destfile=/Users/edmond/workspace/myapp/target/test-results/coverage/jacoco/jacoco.exec
[INFO]
[INFO] --- maven-processor-plugin:2.2.4:process (process) @ myapp ---
[WARNING] diagnostic: warning: The following options were not recognized by any processor: '[mapstruct.defaultComponentModel, mapstruct.suppressGeneratorTimestamp]'
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myapp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 161 source files to /Users/edmond/workspace/myapp/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ myapp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ myapp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 24 source files to /Users/edmond/workspace/myapp/target/test-classes
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.3.5.RELEASE:run (default-cli) < test-compile @ myapp <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.3.5.RELEASE:run (default-cli) @ myapp ---
2016-09-17 13:02:17.453 DEBUG 3087 --- [kground-preinit] org.jboss.logging : Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property

██ ██ ██ ████████ ███████ ██████ ████████ ████████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ████████ ██ ███████ █████ ██ ██████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ████████ ██ ██████ ██ ████████ ██ ██

:: JHipster 🤓 :: Running Spring Boot 1.3.5.RELEASE ::
:: http://jhipster.github.io ::

2016-09-17 13:02:19.150 WARN 3087 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/myapp/default": Connection refused; nested exception is java.net.ConnectException: Connection refused
2016-09-17 13:02:19.152 INFO 3087 --- [ main] a.p.v.myapp.MyappApp : The following profiles are active: dev
2016-09-17 13:02:24.969 WARN 3087 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-09-17 13:02:26.032 DEBUG 3087 --- [ main] a.p.v.m.config.AsyncConfiguration : Creating Async Task Executor
2016-09-17 13:02:27.293 DEBUG 3087 --- [ main] a.p.v.m.config.MetricsConfiguration : Registering JVM gauges
2016-09-17 13:02:27.314 DEBUG 3087 --- [ main] a.p.v.m.config.MetricsConfiguration : Initializing Metrics JMX reporting
2016-09-17 13:02:30.606 INFO 3087 --- [ost-startStop-1] a.p.v.myapp.MyappApp : Running with Spring profile(s) : [dev]
2016-09-17 13:02:31.162 DEBUG 3087 --- [ main] a.p.v.m.config.CacheConfiguration : Configuring Hazelcast
2016-09-17 13:02:31.206 DEBUG 3087 --- [ main] a.p.v.m.config.CacheConfiguration : Configuring Hazelcast clustering for instanceId: myapp
2016-09-17 13:02:31.209 DEBUG 3087 --- [ main] a.p.v.m.config.CacheConfiguration : Application is running with the "dev" profile, Hazelcast cluster will only work with localhost instances
2016-09-17 13:02:31.341 INFO 3087 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.6.1] Picked Address[127.0.0.1]:13782, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=13782], bind any local is true
2016-09-17 13:02:31.716 INFO 3087 --- [ main] com.hazelcast.spi.OperationService : [127.0.0.1]:13782 [dev] [3.6.1] Backpressure is disabled
2016-09-17 13:02:31.746 INFO 3087 --- [ main] c.h.s.i.o.c.ClassicOperationExecutor : [127.0.0.1]:13782 [dev] [3.6.1] Starting with 2 generic operation threads and 2 partition operation threads.
2016-09-17 13:02:32.375 INFO 3087 --- [ main] com.hazelcast.system : [127.0.0.1]:13782 [dev] [3.6.1] Hazelcast 3.6.1 (20160228 - d0d2a77) starting at Address[127.0.0.1]:13782
2016-09-17 13:02:32.376 INFO 3087 --- [ main] com.hazelcast.system : [127.0.0.1]:13782 [dev] [3.6.1] Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
2016-09-17 13:02:32.376 INFO 3087 --- [ main] com.hazelcast.system : [127.0.0.1]:13782 [dev] [3.6.1] Configured Hazelcast Serialization version : 1
2016-09-17 13:02:32.386 INFO 3087 --- [ main] com.hazelcast.instance.Node : [127.0.0.1]:13782 [dev] [3.6.1] Creating TcpIpJoiner
2016-09-17 13:02:32.395 INFO 3087 --- [ main] com.hazelcast.core.LifecycleService : [127.0.0.1]:13782 [dev] [3.6.1] Address[127.0.0.1]:13782 is STARTING
2016-09-17 13:02:32.563 INFO 3087 --- [ main] c.h.n.t.n.NonBlockingIOThreadingModel : [127.0.0.1]:13782 [dev] [3.6.1] TcpIpConnectionManager configured with Non Blocking IO-threading model: 3 input threads and 3 output threads
2016-09-17 13:02:32.566 DEBUG 3087 --- [ main] c.h.n.t.n.NonBlockingIOThreadingModel : [127.0.0.1]:13782 [dev] [3.6.1] InputThreads selectNow enabled=false
2016-09-17 13:02:32.567 DEBUG 3087 --- [ main] c.h.n.t.n.NonBlockingIOThreadingModel : [127.0.0.1]:13782 [dev] [3.6.1] OutputThreads selectNow enabled=false
2016-09-17 13:02:32.585 INFO 3087 --- [ main] com.hazelcast.cluster.impl.TcpIpJoiner : [127.0.0.1]:13782 [dev] [3.6.1]


Members [1] {
Member [127.0.0.1]:13782 this
}

2016-09-17 13:02:32.662 INFO 3087 --- [ main] com.hazelcast.core.LifecycleService : [127.0.0.1]:13782 [dev] [3.6.1] Address[127.0.0.1]:13782 is STARTED
2016-09-17 13:02:32.746 DEBUG 3087 --- [ main] a.p.v.m.config.CacheConfiguration : Starting HazelcastCacheManager
2016-09-17 13:02:32.754 DEBUG 3087 --- [ main] a.p.v.m.config.DatabaseConfiguration : Configuring Datasource
2016-09-17 13:02:32.863 DEBUG 3087 --- [ cached2] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@5268e0755 pairs: {GET /ping?version=3.6.1&m=bf74a0ee-32c7-42f6-9cd5-4bb447422f23&e=false&l=NULL&p=maven&c=672524cf-65e9-4d0a-9bf0-3f8ee7e5b89d&crsz=A&cssz=A&hdgb=0&ccpp=0&cdn=0&cjv=0&cuptm=52&nuptm=51033 HTTP/1.1: null}{User-Agent: Mozilla/5.0}{Host: phonehome.hazelcast.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
2016-09-17 13:02:33.107 DEBUG 3087 --- [ cached2] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@1e6bec8f5 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{Content-Type: text/plain;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Sat, 17 Sep 2016 11:04:42 GMT}
2016-09-17 13:02:33.322 DEBUG 3087 --- [ main] a.p.v.m.config.DatabaseConfiguration : Configuring Liquibase
2016-09-17 13:02:33.346 WARN 3087 --- [ssor-Executor-1] a.p.v.m.c.l.AsyncSpringLiquibase : Starting Liquibase asynchronously, your database might not be ready at startup!
2016-09-17 13:02:36.764 INFO 3087 --- [ main] a.p.v.m.c.h.HazelcastCacheRegionFactory : Starting up HazelcastCacheRegionFactory
2016-09-17 13:02:38.924 DEBUG 3087 --- [ssor-Executor-1] a.p.v.m.c.l.AsyncSpringLiquibase : Started Liquibase in 5577 ms
2016-09-17 13:02:45.294 DEBUG 3087 --- [ main] a.p.v.m.c.apidoc.SwaggerConfiguration : Starting Swagger
2016-09-17 13:02:45.312 DEBUG 3087 --- [ main] a.p.v.m.c.apidoc.SwaggerConfiguration : Started Swagger in 17 ms
2016-09-17 13:02:47.732 WARN 3087 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2016-09-17 13:02:47.747 WARN 3087 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2016-09-17 13:02:50.203 INFO 3087 --- [ main] a.p.v.myapp.MyappApp : Started MyappApp in 39.89 seconds (JVM running for 68.597)
2016-09-17 13:02:50.220 DEBUG 3087 --- [ main] a.p.v.myapp.MyappApp : Routing service toward RouterManager
2016-09-17 13:02:50.229 INFO 3087 --- [ main] a.p.v.myapp.MyappApp : Consumer started!




^C2016-09-17 13:02:59.462 INFO 3087 --- [.ShutdownThread] com.hazelcast.instance.Node : [127.0.0.1]:13782 [dev] [3.6.1] Running shutdown hook... Current state: ACTIVE
2016-09-17 13:02:59.462 INFO 3087 --- [.ShutdownThread] com.hazelcast.core.LifecycleService : [127.0.0.1]:13782 [dev] [3.6.1] Address[127.0.0.1]:13782 is SHUTTING_DOWN
2016-09-17 13:02:59.463 WARN 3087 --- [.ShutdownThread] com.hazelcast.instance.Node : [127.0.0.1]:13782 [dev] [3.6.1] Terminating forcefully...
2016-09-17 13:02:59.464 INFO 3087 --- [.ShutdownThread] com.hazelcast.instance.Node : [127.0.0.1]:13782 [dev] [3.6.1] Shutting down connection manager...
2016-09-17 13:02:59.586 INFO 3087 --- [ Thread-6] a.p.v.m.c.h.HazelcastCacheRegionFactory : Shutting down HazelcastCacheRegionFactory
2016-09-17 13:02:59.607 INFO 3087 --- [ Thread-6] a.p.v.m.config.CacheConfiguration : Closing Cache Manager
hostname:myapp edmond$

这是我为生产做好准备的地方:

hostname:myapp edmond$ ./mvnw package -Pprod -DskipTests
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Myapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
.
.
.
[INFO] Building war: /Users/edmond/workspace/myapp/target/myapp-0.0.1-SNAPSHOT.war
[INFO]
[INFO] --- spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) @ myapp ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.982 s
[INFO] Finished at: 2016-09-17T13:03:28+02:00
[INFO] Final Memory: 66M/481M
[INFO] ------------------------------------------------------------------------
hostname:myapp edmond$

这是我在生产环境中运行它的地方:

hostname:myapp edmond$ java -jar target/myapp-0.0.1-SNAPSHOT.war

* JHIPSTER *

:: JHipster 🤓  :: Running Spring Boot 1.3.5.RELEASE ::
:: http://jhipster.github.io ::

2016-09-17 14:04:08.512 WARN 4419 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/myapp/default": Connection refused; nested exception is java.net.ConnectException: Connection refused
2016-09-17 14:04:08.520 INFO 4419 --- [ main] a.p.v.myapp.MyappApp : The following profiles are active: prod
2016-09-17 14:04:15.893 WARN 4419 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-09-17 14:04:25.844 ERROR 4419 --- [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)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
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)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
... 6 common frames omitted
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.addFilter(Ljava/lang/String;Ljavax/servlet/Filter;)Ljavax/servlet/FilterRegistration$Dynamic;
at org.springframework.boot.context.embedded.AbstractFilterRegistrationBean.onStartup(AbstractFilterRegistrationBean.java:225)
at org.springframework.boot.context.embedded.FilterRegistrationBean.onStartup(FilterRegistrationBean.java:41)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:225)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:85)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:209)
at org.springframework.boot.context.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:55)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5240)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 6 common frames omitted

2016-09-17 14:04:25.846 ERROR 4419 --- [ 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)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:787)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:346)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:89)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:76)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:457)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:168)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:160)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.domain.smth.myapp.MyappApp.main(MyappApp.java:76)
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:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
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)
... 1 common frames omitted
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:924)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 6 common frames omitted

2016-09-17 14:04:25.847 WARN 4419 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
2016-09-17 14:04:25.893 ERROR 4419 --- [ main] o.s.boot.SpringApplication : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.domain.smth.myapp.MyappApp.main(MyappApp.java:76)
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:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:99)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:76)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:457)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:168)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:160)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 14 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:346)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:89)
... 19 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:787)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 21 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 23 common frames omitted
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:924)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 25 common frames omitted

Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
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:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
... 1 more
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.domain.smth.myapp.MyappApp.main(MyappApp.java:76)
... 6 more
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:99)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:76)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:457)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:168)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:160)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 14 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:346)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:89)
... 19 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:787)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 21 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 23 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:924)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 25 more
hostname:myapp edmond$

编辑日期:2016 年 11 月 25 日

  • 我删除了 pom.xml 中嵌入的 tomcat 的所有引用,因为我的项目不需要。

  • 我删除了 Servlets/HTTPServlet 的所有引用。

  • 我现在使用 SpringApplication 而不是 ApplicationContext 运行它

最佳答案

仔细查看您的日志后,我认为您的应用程序正在尝试获取应用程序的配置,即正在查找 http://localhost:8888/myapp/default

8888端口下运行的大多是spring clod config service (here is the documentation)。由于您不想运行注册表服务,请检查您的微服务的配置方式,例如查看应用程序配置文件夹中的 boostrap-[profile].yml。

干杯,老兄

关于java - 如何在没有tomcat的情况下启动jhipster微服务应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39550286/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com