0

Reference questions checked:

  1. Tomcat server not working “externally”
  2. Spring Boot Service works locally but not remotely
  3. How to configure embedded Tomcat integrated with Spring to listen requests to IP address, besides localhost?

We have Spring Boot app deployed as standalone Java executable in embedded tomcat server on 192.168.22.125 Linux environment. In the same environment we also have Weblogic 12C application running on different port (9045) and we are able to access it the browser. Assuming we have a rest end point in Spring Boot app as 192.168.22.125:8888/jobs/uploads, we are able to access this endpoint from a Java app (also deployed in Weblogic) like below.

    URL url = new URL(serverURL);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    ...
    ...

But we are not able to access the same from either the browser or using wget in windows powershell. Referring question 1, we found that problem is with browser.Referring question 2, the solution might be adding the port to router configuration (This will be last option if nothing else works). And when i tried netstat on puttyt connected to that envioment for the 8888 port, the output is

tcp46      0      0  :::.8888                 :::.*   LISTEN

But for the port 9045, where the Weblogic app is running, the output is

tcp46      0      0  192.168.22.125:9045      *.*     LISTEN

So after referring question 3, I tried server.address=192.168.22.125, with the hope that the Tomcat will bind the this and start listening to requests. Even though the netstat output has changed, the result is same (Maybe I am missing some logical understanding here?).

So my questions are,

  1. What other solutions do I need to try?
  2. Why the app deployed in Weblogic is accessible but not the Spring Boot app from the browser? What additional settings/configurations need to be done?
  3. Why request from Java app (deployed in Weblogic) is getting successful but not from browser? Is it because the Java app is running in the same environment as Spring boot app or some checks are left out in case of requests like these?

Any additional resources for further understanding these network things would be very helpful. Thank you.

1 Answers1

1

Answer: By deduction it seems that you are able to access the Weblogic app on port 80 because your router has forwarded port 80. If a Java app running on the same Linux instance (i.e. the localhost) can access the REST api, then it seems clear you need to forward the REST api's port in the firewall settings - port 8888 in your example.

If there is a firewall between the Windows machine and the REST service, you will not be able to access it directly without forwarding the port.

Also, make sure you include the non-standard port in your url like this:

http://192.168.22.125:8888/jobs/uploads

Assumptions: If I understand your questions, you have a Linux instance which is hosting a Weblogic web app and a Spring Boot REST api. You can access the Weblogic app directly in the browser from a remote connection from a Windows machine, but not the REST api. A Java app on the same Linux instance can access the REST api. If I understand correctly, there is also a firewall between the Windows machine and the Linux instance.

MAD-HAX
  • 173
  • 1
  • 7
  • The Weblogic app is deployed on 9045, which means the router has forwarded this port. Also the Java app is also deployed in Weblogic. And I am including the non-standard port in my url. I think for now the only solution is forwarding the port. – Ganapathi Basimsetti Dec 14 '18 at 07:55
  • @GanapathiBasimsetti I am confident that this is the only solution to get the functionality you are looking for within the constraints or your network topology. Please mark my answer as the solution if you would. Take care. – MAD-HAX Dec 14 '18 at 19:18