简体   繁体   中英

Dose an application (executable jar) need permission to listen on a port on centos?

I am running a Spring Boot application that I exported from Eclipse as an executable JAR. I have tested it on local host on a Windows machine, both in Eclipse and as an executable JAR.

On my local Windows machine, I can connect to the executable JAR's REST API using RESTClient for Firefox. The executable also successfully sends a message to a remote server when it initialises on my windows device.

I am trying to deploy the executable to a CentOS device to test it. I have allowed all traffic through the firewall by setting the default for Input to accept using IP tables (I know, a very bad idea, but the device won't be alive for more than a few mins for a demo).

The executable JAR runs on the CentOS system. It says it is listening on port 8080, it successfully sends information to another remote server when initialised; but I cannot access the REST API delivered by the Spring application.

The executable launches on the CentOS server without any complication. I can ping the centOS server, I can SSH into the server; but when I try using RESTCLient to access the machine, I am told that the URL is invalid, and when I try make a GET request using my browser I am told the connection was reset. On the console for the spring application nothing registers when I try and make a connection to the device.

Can I deploy the application to the CentoOS server in this way or does it need additional permissions to listen to a port? Please Advises!

Do you have a firewall activated? So you have to open the port in the firewall settings:

firewall-cmd --zone=public --add-port=8080/tcp --permanent

Then remember to reload the firewall for changes to take effect.

firewall-cmd --reload

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM