我正在使用JHipster基础架构开发一个应用程序,作为这套工具的新手,我不知道为什么我的网关没有按预期工作。
我使用自定义开发配置文件(devh2),然后用它启动应用程序(mvnw -Pdevh2)。
它随机重启,我不知道为什么...... ^^!
启动几秒钟后(它已在注册服务器上注册正常),它显示:
DEBUG 59072 --- [ XNIO-2 task-2] e.j.u.g.a.AccessControlFilter : Access Control: allowing access for /userback/api/account, as no access control policy has been set up for service: userback
WARN 59072 --- [rixMetricPoller] com.netflix.spectator.api.Spectator : no config impl found in classpath, using default
DEBUG 59072 --- [ XNIO-2 task-4] e.j.u.g.a.AccessControlFilter : Access Control: allowing access for /userback/api/rols, as no access control policy has been set up for service: userback
WARN 59072 --- [ Thread-2] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1513153436519, current=DOWN, previous=UP]
INFO 59072 --- [ Thread-2] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
INFO 59072 --- [ Thread-2] com.netflix.discovery.DiscoveryClient : Unregistering ...
WARN 59072 --- [nfoReplicator-0] o.s.b.a.h.ElasticsearchHealthIndicator : Health check failed
java.lang.IllegalStateException: Future got interrupted
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:72)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:57)
at org.springframework.boot.actuate.health.ElasticsearchHealthIndicator.doHealthCheck(ElasticsearchHealthIndicator.java:52)
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
at org.springframework.cloud.netflix.eureka.EurekaHealthCheckHandler.getHealthStatus(EurekaHealthCheckHandler.java:103)
at org.springframework.cloud.netflix.eureka.EurekaHealthCheckHandler.getStatus(EurekaHealthCheckHandler.java:99)
at com.netflix.discovery.DiscoveryClient.refreshInstanceInfo(DiscoveryClient.java:1362)
at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:100)
at com.netflix.discovery.InstanceInfoReplicator$1.run(InstanceInfoReplicator.java:88)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.InterruptedException: null
at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1326)
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:263)
at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:98)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:68)
... 16 common frames omitted
尝试重新启动,但......
INFO 59072 --- [ restartedMain] es.jumbo.userfront.UserfrontApp : The following profiles are active: swagger,devh2
ERROR 59072 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotations(Class.java:3446)
at org.springframework.core.type.StandardAnnotationMetadata.<init>(StandardAnnotationMetadata.java:68)
at org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition.<init>(AnnotatedGenericBeanDefinition.java:56)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:167)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:142)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:131)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:159)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:135)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
at org.springframework.boot.SpringApplication.load(SpringApplication.java:635)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:355)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
at es.jumbo.userfront.UserfrontApp.main(UserfrontApp.java:70)
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.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
启动器类:
public static void main(String[] args) throws UnknownHostException {
SpringApplication app = new SpringApplication(UserfrontApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
if (env.getProperty("server.ssl.key-store") != null) {
protocol = "https";
}
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\t{}://localhost:{}\n\t" +
"External: \t{}://{}:{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
env.getProperty("server.port"),
protocol,
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getActiveProfiles());
String configServerStatus = env.getProperty("configserver.status");
log.info("\n----------------------------------------------------------\n\t" +
"Config Server: \t{}\n----------------------------------------------------------",
configServerStatus == null ? "Not found or not setup for this application" : configServerStatus);
}
派对开始的行是
Environment env = app.run(args).getEnvironment();
但是,args只设置了一个属性: - spring.profiles.active = devh2
重新启动尝试后,应用程序从注册表服务器取消注册。
有谁知道,为什么会这样?
提前致谢
解决
我真的不知道原因,但是清空我的maven本地存储库并重新启动所有actor(注册表,网关和微服务),一切都按预期工作(所有依赖项已经再次下载)。当我有更多的时间,我会尝试深入探究为什么会发生这种情况,但我认为git分支是负责任的。可能另一个分支可以下载不同的库,或者不同的库版本