Spring boot deployment - java

I am developing a spring boot rest API for mobile application (without view or JSP pages) , I am deploying the API on a windows server (dedicated) , I installed the tomcat server and MySQL server on the server , when I am trying to access the application from the server localhost everything is ok , ex: localhost:8080/api/users, but when I am trying to access it from another pc using my server IP I get cannot reach ex: 162.144.188.112:8080/api/users
the same thing happens when I want to access MySQL server using server IP.
so I do not know is there any issue in my server , or I just miss something in the configuration for MySQL and tomcat server ?

If you can access it locally but not remotely, it has to be a missing firewall rule in your Windows Server or there is an additional firewall between your remote desktop and your server.
For the firewall of your Windows Server:
In the Start menu, type Windows Firewall with Advanced Security and then...
Right click on Inbound Rules and select New Rule...
For the rule type, take Port then click Next >
Select TCP and Specific local ports with 8080 filled in the text box, then click Next >
Allow the connection, then click Next >
Keep the default for the next page (Profile), click Next >
Give a name to your rule and click Finish
As said before, as long as your MySQL server is on the same server than your application, do not expose its port (3306).

Try to figure out if your server is accepting the connections. It seem's that your server port is not listening or is blocked.
if you use linux enter systemctl status httpd
and see the status of your server
Also note that spring boot has embeded tomcat so you don't need to install tomcap manualy.

You don't need to install tomcat to use spring boot. There is a starter that allows you to embed the servlet container and package everything inside a jar at build time
Therefore, starting the application is done simply by running java -jar.
Check out the tutorial to know how to correctly deploy a spring boot application

Related

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

Why tomcat is running when I deploy my projects on netbeans using glassfish?

I use xampp to open mysql and stop other services. But when I run my servlet project in netbeans it opens glassfish server, at that time in xampp, tomcat status is running. What is the reason?
Go to xampp setings and stop the tomcat server or change its default port from 8080 to anything else. once you will change the port no. your problem will be solve.

Openshift Connect To MySQL From Local Java Application

I'm using a scalable app on openshift and I'm trying to access its database from a local app but I am having trouble setting up the connection. I need to access my MySql 5.5 database.
IDE: Netbeans 7.4
I am using the environment variable values for the connection. I have no trouble connecting to it using my JBoss app in Openshift. Any help would be much appreciated. Sorry for the incomplete info. I am new here in SOF.
If you have the rhc client installed (see Client Tools Installation Guide if not), you can have it port forward to the server via rhc port-froward. Use localhost as the Host and port number it tells you, with the user name and password supplied from the application page.
Note this will only work when running locally, and the the rhc command will have to be running as well
See also 10.13. Port Forwarding

Is Geoserver not allowing in Cross Domain data access (getFeatureInfo)?

My Geoserver is running on the port 8080(using tomcat 7) & My Application is running on 8084 with different server(tomcat 6).
The shapefile is viewing properly but on click event no feature information coming ,it's always going in waiting mode.
If i'm giving same port & server to run geoserver & application then there is no problem everything is working properly.
but my requirement is to run application & geoserver on different-different port.
Is It possible to make CrossDomain request? Because my requests are denied by the Geoserver.
it is better to use same tomcat port for both geoserver and your application. and refer this link
https://gis.stackexchange.com/questions/20328/path-to-proxy-cgi-for-geoserver-is-not-accessible-in-browser

problem with tomcat 6

I just started the tomcat and opened my browser and gave http://localhost:8080. But i found 404 error.
I tried running the same in eclipse i got the following error message.
Several ports (8005, 8080, 8009)
required by Tomcat v6.0 Server at
localhost are already in use. The
server may already be running in
another process, or a system process
may be using the port. To start this
server you will need to stop the other
process or change the port number(s).
What could be the problem?
I just started the tomcat and opened my browser and gave http://localhost:8080. But i found 404 error.
Tomcat runs fine, but there was nothing to serve on the given URL. There's no ROOT webapp anywhere or there's no welcome file. You need to either deploy a webapp or let the URL point to a valid resource.
I tried running the same in eclipse i got the following error message.
Several ports (8005, 8080, 8009) required by Tomcat v6.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
A port can be used only once by only one application at time. This indicates that you haven't shutdown the first instance of Tomcat before you run the one in Eclipse which is apparently been configured to listen on same ports.
If you are using windows, probably tomcat is running as a service.
Control Panel -> Administrative Tools -> Services -> Find Apache Tomcat 6
Right Click and choose properties
Startup Type : change it to manual, and hit the stop button.
click, ok and close all windows.
You can now run tomcat from eclipse IDE without changing the ports.
Just go and kill the javaw process.

Categories

Resources