I'm using Intellij, attempting to deploy a Tomcat application, but whenever I try to run it, I get the following error:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Address already in use
Now I've manually looked for the process happening at that port via:
lsof -i:1098
And I found the java process and killed it too:
ps aux | grep java
kill -9 20386
And that worked, but I have to do this EVERYTIME I open Intellij. If I want to rerun the server without exiting Intellij, I can't, because I'll get this error. Does anyone know of a permanent fix for this and not just manually killing it everytime?
Click on the skull icon after stopping server to kill all associated processes. This should help in resolving the port issue.