I'm not very experienced with web development, so this is probably beginner problem. I have a small project with two Java web applications on two separate machines on Tomcats, one facing the user (frontend, FE app) and communicating to the other (backend, BE app). BE communicates with the DB through TCP and with FE through REST API. Problem is that Apache HttpGet used in the FE app reaches BE app only sometimes, but usually on the FE I get UnknownHostException. BE communication with DB or directly targeting BE REST API from the browser always works.
Which logs should I be looking at, and what should I do setting the Tomcats? Default Tomcat logging doesn't give me a lot of info, but I suppose it's a Tomcat configuration problem, since firewalls are down and all other TCP communication is working without issues. Below is my (very Vanilla) usage of Apache HttpGet:
...
String url = String.format("http://%s/AutoexcludedDBService/nacionalidades", properties.getProperty("dbWebService"));
CloseableHttpClient client = HttpClients.createDefault();
CloseableHttpResponse response = null;
String json = null;
StatusLine statusLine = null;
try {
HttpGet request = new HttpGet(url);
//request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
request.addHeader("accept", "application/json");
request.addHeader("User-Agent", HTTP.USER_AGENT);
RequestConfig requestConfig = RequestConfig.custom()
.setConnectionRequestTimeout(10000).setConnectTimeout(10000).setSocketTimeout(10000).build();
request.setConfig(requestConfig);
response = client.execute(request);
...