0

I am trying to deploy a web application (RODA 2.0) as WAR on a debian stretch into tomcat 8.5 and openjdk 8, and I get a java.net.BindException: Address already in use when starting up (see full stacktrace at https://pastebin.com/SSDJX6yc). Now, the webapp really tries to listen on port 2552, but it is not used, and running lsof -ni :2552 in a loop shows that at no point is it actually used. On osx it succeeds starting even in tomcat, and successfully listens on the given port.

I realized that maybe tomcat security policies prevent this, but trying to use the catalina.policy from the osx machine yielded the same result. I also tried to add a grant entry to the original debian policy files:

grant codeBase "war:file:${catalina.base}/webapps/ROOT.war*" {
    permission java.net.SocketPermission "192.168.*:2552", "listen, connect, accept, resolve";
};

Do you have any idea what the actual problem could be, and how to solve it (aside from trying to modify RODA to not try to connect on the given port)?

P.Péter
  • 499
  • 2
  • 6
  • 17

1 Answers1

0

I found the problem (most probably): there was a zombie (defunct) java process that was running and most probably really occupying port 2552. And lsof failed to display it. The problem went away after a hard reboot (a soft reboot did not seem to go through, the VM just got unresponsive).

Moral: don't just trust lsof, try other tools like nmap and netstat, and look out for zombies!

P.Péter
  • 499
  • 2
  • 6
  • 17