У меня есть приложение, развернутое на JBoss WildFly 13.0.0. Наконец, EAR работает на EE8 в macOS High Sierra 10.13.6.Все методы работают нормально при вызове с веб-страниц приложений.
Я могу успешно пропинговать 'Мой IP-адрес', 127.0.0.1 & locahost:
Пинг 192.999.9.255 PING 192.999.1.255 (192.999.9.255): 56 байтов данных 64 байта из 192.999.1.23: icmp_seq = 0 ttl = 64 время = 0,067 мс 64 байта из 192.999.1.23: icmp_seq = 1 ttl = 64 время = 0,147 мс 64 байта из 192,99.1.23: icmp_seq = 2 ttl = 64 времени = 0,098 мс
PING 127.0.0.1 (127.0.0.1): 56 байтов данных 64 байта из 127.0.0.1: icmp_seq = 0 ttl = 64 времени = 0,046 мс 64 байтаот 127.0.0.1: icmp_seq = 1 ttl = 64 времени = 0,085 мс 64 байта от 127.0.0.1: icmp_seq = 2 ttl = 64 времени = 0,076 мс
PING localhost (127.0.0.1): 56 байтов данных 64байты из 127.0.0.1: icmp_seq = 0 ttl = 64 времени = 0,041 мс 64 байта из 127.0.0.1: icmp_seq = 1 ttl = 64 времени = 0,084 мс 64 байта из 127.0.0.1: icmp_seq = 2 ttl = 64 время = 0,090 мс
Стандартные usr / hosts:
127.0.0.1 localhost
255.255.255.255 broadcasthost
:: 1 localhost
fe80 :: 1% lo0 localhost
Я могу получить доступ к одному из веб-сервисов и отобразить JSON из curl:
MacBook-Pro:bin NOTiFY$ curl "http://localhost:8080/NOTiFYwell/notifywell/get-all-enumbers/"
[
{
"id": "5b6c5dbefac4f7105b3cca2e",
"code": "E100",
"name": "Curcumin (from turmeric)",
"colour": "Yellow-orange",
"status": "Approved in the EU.Approved in the US."
},
и из браузера:
Однако, когда я запускаю свой тест JUnit 5:
@Test
public final void test01GetListEnumbers() throws IOException {
System.out.println(">>>>> test01GetListEnumbers .....");
String url = "http://localhost:8080/NOTiFYwell/notifywell/get-all-enumbers/";
System.out.println(">>>>> test01GetListEnumbers url = " + url);
HttpGet httpGet = new HttpGet(url);
httpGet.setHeader(CONTENT_TYPE, APPLICATION_JSON);
//Execute and get the response.
HttpClient httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(httpGet);
System.out.println(">>>>> test01GetListEnumbers response getStatus = " + response.getStatusLine().getStatusCode());
System.out.println(">>>>> test01GetListEnumbers response getEntity = " + EntityUtils.toString(response.getEntity()));
}
я получаю:
test01GetListEnumbers ..... test01GetListEnumbers url = http://localhost:8080/NOTiFYwell/notifywell/get-all-enumbers/ test01GetListEnumbers response getStatus = 404 test01GetListEnumbers response getEntity =
<code><html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /NOTiFYwell/notifywell/get-all-enumbers/. Reason:
<pre> Not Found