无法启动jHipster微服务网关开箱即用

时间:2017-06-04 03:05:46

标签: tomcat jhipster microservices

所以我开箱即用了一个jHipster微服务网关。我有jHipster 4.5.2。除了回答设置问题之外,我没有做任何事情(你可以在下面看到我的答案)。我指定它在localhost:8082上运行。我也安装了Tomcat 8.5.15,它可以工作;当我打开它时,我在localhost:8080看到服务器页面。

我尝试通过执行以下操作来运行网关:

/Users/jimstewart/apache-maven-3.3.9/bin/mvn -Pprod package
java -jar target/data-gateway-0.0.1-SNAPSHOT.war

当它尝试启动时,我会在早期收到以下警告:

Could not locate PropertySource: I/O error on GET request for "http://localhost:8761/config/DataGateway/dev/master": Connection refused; nested exception is java.net.ConnectExc

但Tomcat服务器正在运行:当我转到localhost:8080页面就在那里。

有大量的样板,数百行,所以我不会全部复制它们。但在以下错误中不断重复

2017-06-03 22:48:58.671 ERROR 1271 --- [           main] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error

2017-06-03 22:48:58.674  WARN 1271 --- [           main] 
c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failed with 
message: java.net.ConnectException: Connection refused

2017-06-03 22:48:58.675 ERROR 1271 --- [           main] 
com.netflix.discovery.DiscoveryClient    : 
DiscoveryClient_DATAGATEWAY/DataGateway:5ee0c99cb98fec0674d7db2672260892 - was 
unable to refresh its cache! status = Cannot execute request on any known server

2017-06-03 22:49:17.689  WARN 1271 --- [nfoReplicator-0] 
c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failed with message: java.net.ConnectException: Connection refused

最终它只是在没有开始的情况下关闭。

我也尝试通过从NetBeans运行它来启动它。当我打开Tomcat时,它会退出,因为“无法启动Tomcat:端口8080已经在使用中”。所以,很好,在关闭Tomcat的情况下启动它,这样它就可以自动启动它。然后它将无法启动因为“连接被拒绝”。

如何让我的应用启动?

我通过以下方式回答了设置问题:

What kind of application? Gateway application
What is the base name? DataGateway
Would you like to install other generators? No
Which port do you want to run it on? 8082
What is your default package name? com.kidslearntocode.datagateway
Do you want to use the jHipster registry? Yes
What kind of authentication? JWT
What type of database? SQL
What production database? mySQL
What development database? mySQL
Maven or Gradle? Maven
Which other technologies? None
Which framework? [beta] Angular 4
LibSass? Yes
Internationalization? No
Other languages? None

1 个答案:

答案 0 :(得分:4)

此处显示错误:

Could not locate PropertySource: I/O error on GET request for "http://localhost:8761/config/DataGateway/dev/master": Connection refused; nested exception is java.net.ConnectExc

这意味着你没有启动JHipster注册表。 为此,您有两个解决方案:

1)使用Docker,只需启动:docker-compose -f src/main/docker/jhipster-registry.yml up -d

2)克隆项目https://github.com/jhipster/jhipster-registry,然后yarn install并启动注册表:./mvwn

然后,尝试在http://localhost:8761

登录JHipster注册表

https://jhipster.github.io/api-gateway/

的更多信息

PS:我不太了解你如何在这里使用Tomcat,因为你的网关已经使用了嵌入式Undertow,所以你不需要另一台服务器。