Boot Spring Application failed on sub user - linux

Whenever I try to run my spring boot application, my Linux machine returns me the following issue:
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-80]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23][...](LifecycleBase.java:150) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
... 21 common frames omitted
Caused by: java.net.SocketException: Permission denied[...]
The Tomcat connector configured to listen on port 80 failed to start.
The port may already be in use or the connector may be misconfigured.
Hope someone can help me.

I'm guessing you're on Ubuntu. Ports under 1024 can only be opened by root so as a normal unprivileged user you can't run your app on port 80. Why not use another port using server.port property?

As clearly mentioned the port is already in use. Configure spring boot to use some other port.
As said in docs either set server.port as system property using command line option to jvm --server.port=8090 or add application.properties in /src/main/resources/ with
server.port = 8090
For random port use
server.port=0

Run it as root, if Ubuntu or Debian use Sudo your_command. Because ports under 1024 can be used just by root.

Related

Spring Boot App deployed on Azure App Service port 8080

I'm trying to deploy a Spring Boot Rest Api (Gradle) to an Azure app service. There is an executable jar in the /home/site/wwwroot folder and a startup command (java -jar /home/site/wwwroot/app.jar). When I execute this script, the spring api starts but throws the following error: "The Tomcat connector configured to listen on port 80 failed to start. The port may already be in use or the connector may be misconfigured."
I can't run the app on another port because the Azure App Service only allows inbound HTTP traffic on port 80 and 443 for SSL. I tried killing the process that is running on port 80 but that kills my ssh terminal.
Is there a solution to 'clear' the proces running on port 80 and actually run my Spring application on it?
"The Tomcat connector configured to listen on port 80 failed to start.The port may already be in use or the connector may be misconfigured."
The error is because another process is running on the same port. To solve this, you have two options.
Try to run the application on a port other than 8080.
Identify and stop the process running on that specific port.
Check this post on how to change the default tomcat port number.
See: how the spring boot configuration works.
Check this blog and SO thread might be helpful. Tomcat Server Error - Port 8080 already in use

How to check jboss running in redhat environment?

I have installed jboss-eap-6.2.0 in redhat environment and started the server.But i'm not able to access the home page via http://<>:8080 .Here i have to access home using ip address or name like http://<>:8080 its getting time out. So i would like to know what is the problem here and why not to see the jboss home here ?
1.Is there any way to check the server running in putty command line ?
2.Able to install the software connecting via ip but same ip is not allowing to access jboss page .So is firewall blocking the port 8080 ?
Please advise
Open the standalone.xml file from the JBOSS_HOME/standalone/configuration directory.
Look for all the texts jboss.bind.address in there and change the ip with the server's IP address so that you can access it from your local pc.
For example
${jboss.bind.address:192.168.1.68}
${jboss.bind.address.management:192.168.1.68}
... and so on...
Also, you can look for the loop back ip address(127.0.0.1) in the xml file as well and replace it.
Even i faced same issue wheni installed jboss7 on centos machine.i found that 8080 port was being used by some other app,thus disabling jboss7 to use that port.
-you can
telnet localhost 8080 (or) ps -ef|grep java
to check if jboss is running
if its running properly and you still not able to connect through your browser
use nmap to check services running on that port
you can edit your port configuration at
jboss/standalone/configuration/standalone.xml
run jboss again
You need to set the value of the default interface in socket-binding as well in your standalone.xml.

connecting jconsole to linux box connection failed

I am new to linux and just deployed a java program to run on a linux server. I tried to connect from my windows machine to the linux box with jconsole and got an error.
Connection Failed: non-JRMP server at remote endpoint
I searched online and found the following suggestion was to run the following:
java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=
[YOUR PORT] -Dcom.sun.management.jmxremote.ssl=
false -Dcom.sun.management.jmxremote.authenticate=false -jar [YOUR JAR NAME]
I entered the following into a batch file and executed it. I then tried to connect using jconsole using the follow command
service:jmx:rmi:///jndi/rmi://ipaddress:port/jmxrmi
as suggested but still cannot (Connection failed: retry)/
I got the same issue but the reason was different, I was hitting http port instead of JMX port.
The error message appeared same as in your case but later I figured out it was port issue.
Since JMX process runs on different port so be careful while opening JConsole on remote server.
Resolved situation by setting hostname to ipaddress when calling process on linux
I faced this problem at localhost.
Wrong port was used.
So, I changed my JMX port to be different from application port in my run configuration and yet, the port changes did not take effect until the application container was restarted.
Fixing above resolved my issue.
Another possible reason for error message Connection failed: non-JRMPserver at remote endpoint: the RootCA-certificate of the server hasn't been added into the client's cacerts file.

Start Tomcat from Eclipse in port 80 ( Linux )

This question has been asked before, but no real answer has been given ( to the best of my knowledge).
Here is the link to the original question:
Start Tomcat from Eclipse in port 80 in Ubuntu with Authbind.
I do need torun tomcat on port 80.
I prefer not having to install tomcat on the computer. I believe it is not required.
I want to avoid using port forwarding ( I have to do it now since I find no other solution)
I am using:
Ubuntu 12.04
Eclipse Juno
Tomcat 7
OpenJDK 64-Bit Serve - java version "1.7.0_07"
I am able to start tomcat in port 80 as a non root user and without installing tomcat.
I follow this article:
http://java.dzone.com/articles/running-tomcat-port-80-user
There are a lot of articles about the topic, but I found this article to be simple an complete.
When I try to start tomcat using eclipse it always fails and complains about port 80 been used. But it is not true.In fact, while eclipse is running and while the error is been shown in the screen I am able to manually start tomcat on port 80.
I have noticed that eclipse complains about port 80 been used when it does not have access rights to that port. I did get the same error before I was not able to manually run tomcat on port 80. The difference is that when I manually run tomcat it did log an access right error, and eclipse complains about the usage of the port.
I have modified the eclipse tomcat launcher to include the option "-Djava.net.preferIPv4Stack=true" and to start tomcat as "authbind --deep start"
But I always get the same error.
If I start eclipse as root them it works fine, so I do believe the problem is related to the access rights on port 80 and not to port to been used.
I do assume that eclipse starts tomcat with the same user rights used to start eclipse.
Could anybody provide some support?. I can work by using port forwarding, but I would really like to know what I am missing and how to do it right.
The easiest way is to start tomcat with a listener on port 8080 and forward port 80 to localhost:8080:
ssh -L 80:localhost:8080 <user>#localhost
Execute this command with sudo
I thing to run something which uses the ports 1-1024 under Linux the process has to have the root privileges.
I am not sure if I can be helpful to anyone, but I solved similar problem as described: I started tomcat with startup.sh script, it was working fine on port 80. I restarted machine (just in case) and tried starting the same tomcat from eclipse, but when I got error about port 80 being used.
Turns out eclipse does not take startup scripts from tomcat installation, so it does not use the authbind configuration. The best solution I came up with is to start eclipse with authbind:
authbind --deep ./STS
As to why this didn't work:
I have modified the eclipse tomcat launcher to include the option "-Djava.net.preferIPv4Stack=true" and to start tomcat as "authbind --deep start"
As I understand you tried passing "authbind --deep start" as arguments to tomcat. I believe the point of authbind is to start application authbind with tomcat as argument. I don't see any way to do it in eclipse.
I am also now learning eclipse like u. Even i faced the same problem as you. Then, i changed the port number then server is starting now.
To change the port number, u need to double click the Apache Tomcat at servers. Then click on ports and change the HTTP/1.1 port to any four digit number u wish and save it.
It will work.

IIS and Glassfish in Windows 7

I installed the newest version of Windows 7.
This is my development box, so I have glassfish installed, which I use for Java applications. Also, I use IIS to run PHP applications. I run both servers on port 80, but never at the same time.
However, since I set up IIS, I can't get glassfish to run. In eclipse, it always gives the following error:
Port conflict: Please stop the server process using the same port as the one used by the Application Server.
A server process is already running on this port but we cannot determine if it's a GlassFish process (lack of info or credentials).If you do not find something else running on this port, check for antivirus software blocking or monitoring this port.
Edit: I tried turning off IIS, and even turned off the IIS feature. Still no luck.
I also ran netstat, and the following are showing up on ports that glassfish uses:
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 NBSDTVL01574:0 LISTENING
TCP [::]:80 NBSDTVL01574:0 LISTENING
Thanks
This turned out to be an issue with my virtual machine. A fresh copy fixed the issue.
this happen because you select the same port number use by the iis and glashfish, i suggest you configure either of the two to use different port number.

Resources