我创建了一个jhipster(v3.4.0)微服务应用,并希望在生产中部署它,但不在tomcat实例上部署。我已将其配置为不需要jhipster-registry或jhipster-console进行日志转发。所以我想要实现的是将其作为java app / jar运行。
以下是使用dev配置文件运行它的日志:
medellangd(Text,AvgLen) :-
medellangd(Text,T,1,0,0),
AvgLen = T.
medellangd([],AvgLen,Space,Words,Chars) :-
T is (Chars/Words),
AvgLen = T.
medellangd([A|B],AvgLen,Space,Words,Chars) :-
succ(Chars,C),
updatewords(A,Space,Words,W),
updatespace(A,S),
medellangd(B,T,S,W,C),
AvgLen = T.
updatewords(A,1,Words,W) :-
member(A, [65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122])
-> succ(Words,S),
W = S
; W = Words.
updatewords(A,0,Words,W) :-
W = Words.
updatespace(A,S) :-
member(A,[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122])
-> S = 0
; S = 1.
这是我准备好制作的地方:
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$
* JHIPSTER *
hostname:myapp edmond$ java -jar target/myapp-0.0.1-SNAPSHOT.war
EDIDTED:2016年11月25日
我删除了pom.xml中嵌入的tomcat的所有引用,因为我的项目不需要。
我删除了Servlets / HTTPServlet的所有引用。
我现在使用SpringApplication而不是ApplicationContext运行它
答案 0 :(得分:0)
仔细查看日志后,我认为恕我直言,您的应用正在尝试获取应用的配置,即正在查找http://localhost:8888/myapp/default。
在端口8888下运行的主要是spring clod config service(here is the documentation)。由于您不想运行注册表服务,请检查您的微服务的配置方式,例如看一下应用程序配置文件夹中的boostrap- [profile] .yml。
欢呼声,duderoot