APPLICATION FAILED TO START how to fix? - spring

Description:
The Tomcat connector configured to listen on port 9009 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 9009, or configure this application to listen on another port.
I get an error of this kind, but I have not changed the port, what should I do in this case?
I can throw application.properties

First, if you would like to check application running on that port please either do netstat command or resmon.exe and if application is user then exit it.
Or start appliation with new port number

Related

Caused by: java.net.BindException: Address already in use: bind

I am trying to run a spring boot application by clicking on Run as -> Spring Boot App. I am getting the error as :
Caused by: java.net.BindException: Address already in use: bind
When I use netstat command, I see the below without process Ids:
netstat -na | find "8080"
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING
TCP [::]:8080 [::]:0 LISTENING
Notice - I am running my code on windows machine
How do I kill these processes?
You can change your application's port number by providing something like server.port=4567 in your application.properties.
OR
You can follow the steps as mentioned in http://www.codeman.in/blog/windows-kill-process-by-port-number-157 to kill process running on a port number:-
Try the command lsof -i, it should list network connections among pid.
Or even better lsof -i :8080
most likely "8080" is being used, either you end task/close the application or simply change the by default port which is being used by Spring boot. Multiple ways you can achieve, application.properties is one of them.
try {
SpringApplication.run(Application.class, args);
} catch (org.springframework.boot.web.server.PortInUseException e) {
//Runtime.exec("pkil")..
//or
SpringApplication.run(Application.class, otherargs);
//SpringApplication.run(Application.class, new String[]{"--server.port=8444"});
//when invoked recursively it is a port rebalancer for port usage among port pool with server as from client for startup stage via application restarts within many busy ports which are used before or without querying.
}

Tomcat is misconfigured for local IP

I have a project on Spring with maven build. (Eclipse IDE on Windows). When I run my Spring Boot application I am getting this error
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
I have tried to listen to another port (using application.properties file) but the error still persists.
I have also tried command line to kill my process using these two lines.
// Step 1
netstat -ano | findstr :yourPortNumber
//Step 2
taskkill /PID typeyourPIDhere /F
I think my tomcat is misconfigured for the project. Weirdly, it seems to work on another project but on this one. How can that be possible? Thanks for the help in advance.
EDIT:
I am sorry but I forgot to mention that I wanted to run Tomacat on my PC's IP. It is working fine for localhost.
Here is my application.properties file:
spring.http.multipart.enabled=false
server.address=172.27.86.141
server.port=8080

"Address already in use: bind" when running Spring Boot application

I have a problem with running my sample Spring Boot Application.
When I try to run it, this error occurs:
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473)
o.apache.catalina.core.StandardService : Failed to initialize connector [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:335)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:57)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:52)
at
Is it ok the first time you run it, and run it again you get an error?
If this is the case, You need to stop service before running again.
Here is a way to stop.
Click the stop button that looks like this:
"Address already in use" means, there is already another application running on port 8080. Use your OS tools to find that process and end it, before you start your application, or let your application run on another port. If you use an embedded server in your Boot application, you can specify the following property:
server.port=8085
Of course you can choose whatever port you want.
I have a very simple solution:
As the answer above stated, when you start Spring Boot app, the PID of underneath server(Tomcat or Undertow, or whatever) will be shown in the console; you may start again the app without terminating the former one, especially when you are in debug mode, thus the error. This applies to Intellij, too.
But, if you have started again, the PID is no longer available for you because previous session output is cleared.
So, if you are using Eclipse, just close it, and open Task Manager to terminate other java.exe JVM process. Be sure that you have no other JVM-based services running which cannot be stopped. (Like Kafka server, Apache Storm, etc.)
The Tomcat instance is one of them.
Log shows that server is already started on port 8080. I faced the same problem. go to windows task manager and end process that is javaw.exe, it worked on my application.
Two possibilities
P1.Another Application is using port 8080
Solution:-
a.Stop that application and free port 8080 for your application.
b.Change your application server port, for that create a file named
application.properties in resource folder and add property
server.port = 8085
(8085 can be replaced by any port number of your choice which will not conflict with other
application server ports)
location of application.properties file
snippet of application.properties file
P2. Your application is already running
Solution
a. Pretty simple solution for this situation is stop your currently
running application and rerun it
b.If you want to run multiple instances of your application then keep
current application running change server port as explained above and
run the application the new instance will run of another port.
Even I faced this issue u can just stop the application(there is a stop button on the top toolbar) and restart again it worked for me and I used STS
In the Eclipse situation, check if there are items running in the window "Progress"(Windows > Show View > Progress)
Stop the running process, which might be locking your desired port.
Got the same error.
The springboot application has inbuilt tomcat server which runs on port 8080..if you have any other process currently running on port 8080,The java.net.BindException will raise..so kill the processes which are using 8080 thorugh cmd as follows:
-->
open command prompt as Administrator.
--> netstat -ano | findstr :<PORT>
netstat -ano | findstr :8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 10568
TCP [::]:8080 [::]:0 LISTENING 10568
-->taskkill /PID <PID> /F
taskkill /PID 10568 /F
Now if you want recheck your running process by using netstat -ano | findstr :8080 command..
and again restart or rerun our application..
This is for first ever time you wanted to run springboot application.
Hope this might be helpfull,worked for me :)
Second case:
In the first time you run ok right? and run again it got an error? If right, You need stop service before run again..if it is the case follow #Sang9xpro
answer above.
Seems your server is already up. If you are using linux based system, type following command in terminal to check which port is active on your system.
"ps -ef | grep 8080"(or whatever port is mentioned)
Now you need to kill this one if you wish to run the server on same port.
kill -9 8080
Voilla!! Try booting your application once again and it will work.
Extra:
You'll come to me complaining an important application is already listening on mentioned port(8080) and you do not want to kill it. No probs.
Create an application.properties file inside your resource folder and change port to whatever you like.
server.port = 8081
Voilla!! You did it!! :)
Let me know if further clarifications required.
This is because you have run the spring boot application once in your eclipse IDE and closed the application and you assume that the embedded server is stopped. But it is not the case. Even after you closed your application in Eclipse -> Console window, embedded tomcat server is running. What you can do is, run your spring boot application again and look at the console messages. Immediately after Spring Logo, you can find Starting on with PID 16676. This is the PID you need to search in "Wndows Task Manager -> Processes -> PID". Select that process and "End Task". Now if you start your spring boot application, it will start without issues.

Accessing Port while starting Websphere Server

i am facing the issue in webshpere ..the server is not staringReading configuration for server: server1
ADMU3028I: Conflict detected on port 8896. Likely causes: a) An instance of
the server server1 is already running b) some other process is
using port 8896
ADMU3027E: An instance of the server may already be running: server1
ADMU0111E: Program exiting with error:
com.ibm.websphere.management.exception.AdminException: ADMU3027E: An
instance of the server may already be running: server1
The error seems quite explicit: another program is using port 8896.
To verify this you can use these commands:
(Linux) sudo netstat -lptu|grep 8896
(Windows) netstat -a -b (or other tools)
You can decide to stop the process that create the conflict or change the ports used by WAS:
Updating ports in existing profile
This can be caused when the services don't shut down correctly and the java.exe processes hold a lock on the applications port. (8896).
To resolve this problem you can use one of the following options.
1) Open your taskmanager and end task the java.exe process for your JVM that is holding a lock on the servers port then restart the JVM from the WebSphere console
2) You can restart the physical server so the java.exe process shuts down and releases the port. Once the server starts back up you can start JVM and bring the application up.

Windows could not start the Apache2 on Local Computer - problem

During the installation of Apache2 I got the following message into cmd window:
Installing the Apache2.2 service The
Apache2.2 service is successfully
installed. Testing httpd.conf....
Errors reported here must be corrected
before the service can be started.
httpd.exe: Could not reliably
determine the server's fully qualified
domain name , using 192.168.1.3 for
ServerName (OS 10048)Only one usage of
each socket address (protocol/network
address/port) is normally permitted.
: make_sock: could not bind to address
0.0.0.0:80 no listening sockets available, shutting down Unable to
open logs Note the errors or messages
above, and press the key to
exit. 24...
and after installing everything look fine, but it isn't. If I try to start service I got the following message:
Windows could not start the Apache2 on
Local Computer. For more information,
review the System Event Log. If this
is a non-Micorsoft service, contact
the service vendor, and refer to
service-specific error code 1.
Apach2 version is 2.2.9
Does anyone have the same problem, or could help me.
There is some other program listening on port 80, usual suspects are
Skype (Listens on port 80)
NOD32 (Add Apache to the IMON exceptions' list for it to allow apache to bind)
Some other antivirus (Same as above)
Way to correct it is either shutting down the program that's using the port 80 or configure it to use a different port or configure Apache to listen on a different port with the Listen directive in httpd.conf. In the case of antivirus configure the antivirus to allow Apache to bind on the port you have chosen.
Way to diagnose which app, if any, has bound to port 80 is run the netstat with those options, look for :80 next to the local IP address (second column) and find the PID (last column). Then, on the task manager you can find which process has the PID you got in the previous step. (You might need to add the PID column on the task manager)
C:\Users\vinko>netstat -ao -p tcp
Conexiones activas
Proto Dirección local Dirección remota Estado PID
TCP 127.0.0.1:1110 127.0.0.1:51373 TIME_WAIT 0
TCP 127.0.0.1:1110 127.0.0.1:51379 TIME_WAIT 0
TCP 127.0.0.1:1110 127.0.0.1:51381 ESTABLISHED 388
TCP 127.0.0.1:1110 127.0.0.1:51382 TIME_WAIT 0
TCP 127.0.0.1:1110 127.0.0.1:51479 TIME_WAIT 0
TCP 127.0.0.1:1110 127.0.0.1:51481 TIME_WAIT 0
TCP 127.0.0.1:1110 127.0.0.1:51483 TIME_WAIT 0
TCP 127.0.0.1:1110 127.0.0.1:51485 ESTABLISHED 388
TCP 127.0.0.1:1110 127.0.0.1:51487 TIME_WAIT 0
TCP 127.0.0.1:1110 127.0.0.1:51489 ESTABLISHED 388
TCP 127.0.0.1:51381 127.0.0.1:1110 ESTABLISHED 5168
TCP 127.0.0.1:51485 127.0.0.1:1110 ESTABLISHED 5168
TCP 127.0.0.1:51489 127.0.0.1:1110 ESTABLISHED 5168
TCP 127.0.0.1:59264 127.0.0.1:59265 ESTABLISHED 5168
TCP 127.0.0.1:59265 127.0.0.1:59264 ESTABLISHED 5168
TCP 127.0.0.1:59268 127.0.0.1:59269 ESTABLISHED 5168
TCP 127.0.0.1:59269 127.0.0.1:59268 ESTABLISHED 5168
TCP 192.168.1.34:51278 192.168.1.33:445 ESTABLISHED 4
TCP 192.168.1.34:51383 67.199.15.132:80 ESTABLISHED 388
TCP 192.168.1.34:51486 66.102.9.18:80 ESTABLISHED 388
TCP 192.168.1.34:51490 74.125.4.20:80 ESTABLISHED 388
If you want to Disable Skype from listening on port 80 and 443, you can follow the link http://www.mydigitallife.info/disable-skype-from-using-opening-and-listening-on-port-80-and-443-on-local-computer/
Run the httpd.exe from the command line to get an accurate description of the problem.
I had the same error message and it turned out to be a miss configured ServerRoot path. Even after running setup_xampp.bat the httpd.conf had the wrong path.
My error.log was empty and starting the service does not give an informative error message.
the better way to resolve the issue is change the port number in Apache2\conf\httpd.conf . Change the port number as fallows::: Listen 8888 and ServerName machinename:8888 .Restart the Apache server after changing the port number.
I had the same problem. I checked netstat, other processes running, firewall and changed httpd.conf, stopped antivirus, But all my efforts were in vain. :(
So finally the solution was to stop the IIS. And it worked :)
I guess IIS and apache cant work together. If anybody know any work around let us know.
Run the httpd.exe from the command line, as Tim mentioned. The path to PostgreSQL changed, nothing else was running on Port 80 and I didn't see anything in the error.log file.
I clone my boot drive/partition once the base is setup so I don't have to spend three days installing and retweaking everything. Turns I had reinstalled my WAPP stack and used very specific names/versions for PostgreSQL. Windows will not return a specific error message unless you run the command from the command line.
Follow this step it will works fine.
Go to Control panel-->Programs and features-->click Turn Windows features on and off--> see IIS is Checked Or Not If checked please unckeck IIS and restart the computer.After that Open services see Web Deployement Agent Service status if its started please stop.And also see WampAppache and WampSqlID if its not started please start manually. it will works for me.
Hi i also meet this problem today.
And the log error in the Event viewer is as following
The Apache service named reported the following error:
1.Wrapper php-cgi.exe cannot be accessed: (720005)Access is denied.
2.apache service monitor:the requested operation has failed
It is actual the access problem.So the solution as flowing is help me
change the php-cgi.exe security properties
not inheit from parent the permission...
please add the everyone user
if appache and IIS both are running at a time then there is a posibility to hang the apache service,,,,
when i stopped all IIS websites once and then restarted apache service and it works for me....Jai...
Windows Vista Home Premium operating system issue: The easiest way to resolve the issue is to change the port number in Apache2\conf\httpd.conf.
Change the port number at the following lines. 'Listen' from 80 to 8888 and 'ServerName' machinename (ex:localhost) from 80 to 8888. Save then close. Open up Apache Service Monitor and restart service or go to Computer Management > Services and locate Apache 2.2 and start or restart.
Remove apache from Control Panel and delete the apache folder from Program Files and restart the machine, then install apache again. This will solve the problem; if not do the following: Install IIS if not installed, then start IIS and stop it ... Using services start apache service... enjoy apache.
I've had this problem twice. The first problem was fixed using the marked answer on this page (thank you for that). However, the second time proved a bit more difficult.
I found that in my httpd-vhosts.conf file that I made a mistake when assigning the document root to a domain name. Fixing this solved my problem. It is well worth checking (or even reverting to a blank copy) your httpd-vhosts.conf file for any errors and typo's.
if you are using windows os and believe that skype is not the suspect, then you might want to check the task manager and check the "Show processes from all users" and make sure that there is NO entry for httpd.exe. Otherwise, end its process. That solves my problem.
Yes , i had to change the port :80 to :90 as port :80 was busy by some other system resource.
You can see the logs in the folder of Apache2.2\logs
Thanks,
Always double check httpd.conf to see if document root is correctly pointing to an existing folder
#if you have c:\your-main-folder\www\
DocumentRoot "c:/your-main-folder/www/"
#if you have c:\your-main-folder\www\sub-folder\
DocumentRoot "c:/your-main-folder/www/sub-folder/"
DocumentRoot points to a folder that must exist in your drive.
I had the same issue. when i restarted my wamp it turns to Yellow color icon but not green.
In services i stop all sql server services. after that it works for me..
Two thinks that should must be take care.
1 ) port should be different
2 ) stop those services which can be on port 80
i faced the same issue, in my case i needed to add module in httpd.conf
the file was incomplete with incorrect keywords ( like LoadModule )
go to command line, go to C:\Apache24\bin
C:\Apache24\bin > httpd.exe
the reason for the error can be known from the output of the above command
Thanks for the help guys. I found another culprit. Recently SimplifyMedia added a photo sharing option. Apparently it too uses port 80 and prevented Apache from starting up. I hope this helps someone out.
Me also coming the same problem. The solution is goto add or remove programes then click the turn windows features on or off. Turn off the IIS. That is turn off the 'Internet information services' and 'Internet information service removable web core'. I chosed the remaining features are on. Computer will ask to restart the system. Restart ur computer and then install the apache http server. I got it. Server succesfully working...
For me, this was the result of having set the document root (in httpd.conf) to a directory that did not exist (I had just emptied htdocs of a previous project).
Windows 10 - administrator account
I needed to switch the account to an admin type account, in windows services
httpd.exe -k install
fails to add setup with enough user rights.

Resources