Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Intro to Java Web Development with Spark Diving into Web Development Meet Spark

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

I got this example to work but I'm getting a strange bind warning when I run this program. How do I resolve this problem?

WARN org.eclipse.jetty.util.component.AbstractLifeCycle - FAILED ServerConnector@685045ca{HTTP/1.1,[http/1.1]}{0.0.0.0:4567}: java.net.BindException: Address already in use: bind java.net.BindException: Address already in use: bind.

2 Answers

Port 4567 is in use. Make sure that you killed previous app and that port 4567 is free. There are plenty resources how to check which ports are in use and how to kill application related. If however port 4567 is used by system, try to change it "port(4568)" command. How to change port see documentation:

http://sparkjava.com/documentation.html

Changing the port seemed to work. I wonder what was using port 4567....

This site helped me find what was using the port and kill it (on Windows):

http://therealdanvega.com/blog/2015/04/16/windows-kill-process-by-port-number