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

Tomcat connector in failed state what could be wrong? please help me :C

Exception in thread "main" java.lang.IllegalStateException: Tomcat connector in failed state :bootRun FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':bootRun'.

    Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.256 secs Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 1 12:37:16 PM: External task execution finished 'bootRun -Dserver.port=8181'.

6 Answers

Ok. When PID is 4, by reading some stack posts it seems that there is some System process involved.

In this case lets concentrate on running your app on other port. I guess for some reason -Dserver.port=8181 does not work right?

If that is the case, take a look at this StackOverflow post: http://stackoverflow.com/questions/21083170/spring-boot-how-to-configure-port

The easiest way, and in my opinion the proper way is to create application.properties files in src/main/resources directory and put there server.port = 8090. If unsure take a look to the post above, they even have screenshots.

Could you try to do that, and tell me what is the problem, if there is one?

Thank you so much. I am using netbeans and this solution worked for me! Genius!

I hope you looked through Stack Overflow solutions: http://stackoverflow.com/questions/20735205/launching-spring-application-address-already-in-use

Take a look at this one. I remember having the same problem.

  1. First of all make sure you are not re-running the boot run twice. ( With Spring you have to kill old one first, then wait, then restart. Chris is doing that in all 'Spring' courses.

  2. If you are still running only one app, try to kill ports with application directly: (For linux/mac that will work: lsof -i :8080 | grep LISTEN and then kill -9) see the post above how to do that. I suggest this way: you have to figure out which application is using port 8080, and kill it. Using other port is temporary solution. I don't have Windows, take a look, how to see which ports are which with this article: http://www.howtogeek.com/howto/28609/how-can-i-tell-what-is-listening-on-a-tcpip-port-in-windows/

When you find which app is using 8080, kill it and rerun without -Dserver.port option.

I cannot say more, because you show only one line of code to me, so If you really want for someone to take a look: Share your project on GitHub. So that anyone and I can take a look. If you are using IntellijIdea, it is really simple: https://www.jetbrains.com/help/idea/2016.2/share-project-on-github-dialog.html ( Ctrl-Shift-A and then I type 'Share' and pick 'Share Project on Github')

Yup that was the page i was looking i tried to use -Dserver.port=8181 following this http://codedevstuff.blogspot.com/2015/05/change-port-on-spring-boot-application.html as well.

sorry for that one line of code that i showed you here's the project i uploaded on github https://github.com/Lestah/giflib thanks Alexander

I tried to run your App from GitHub. It works just fine. Which means you have problems with your machine, and port, not the java code/spring application itself.

Did you try to localize which program is using port 8080 and kill it, using the article above?

http://www.howtogeek.com/howto/28609/how-can-i-tell-what-is-listening-on-a-tcpip-port-in-windows/

Should be pretty straightforward, typing

  • netstat -aon : should show you ports and PIDs of appications that are using them
  • then you can kill the app that is using port 8080

I tried that on my desktop-pc it runs with no errors but i want it on my laptop to work. I've red the links you send to me about killing the application who uses port 8080

here's what I've found executing the netstat -aon

TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4

that number 4 is the PID who uses my port 8080

so on task manager processes details tab

Name PID Status User name CPU Memory (private working set) Description System and compressed memory 4 Running SYSTEM 00 282,264 K NT Kernel & System

so on the task manager services tab i look for the pid number 4 i cant find that number 4 PID to stop it

Hey Buddy Thanks a lot for helping me on this and thanks to that last link u send to me gave me an idea to change it programmatically it runs now on my laptop free of errors hahaha can i add you as friend here on treehouse?

No problem. Glad to be of some help.