Question

This question has been asked before, but no real answer has been given ( to the best of my knowledge).

Here is the link to the original question: Start Tomcat from Eclipse in port 80 in Ubuntu with Authbind.

  • I do need torun tomcat on port 80.
  • I prefer not having to install tomcat on the computer. I believe it is not required.
  • I want to avoid using port forwarding ( I have to do it now since I find no other solution)

I am using:

  • Ubuntu 12.04
  • Eclipse Juno
  • Tomcat 7
  • OpenJDK 64-Bit Serve - java version "1.7.0_07"

I am able to start tomcat in port 80 as a non root user and without installing tomcat.

I follow this article: http://java.dzone.com/articles/running-tomcat-port-80-user There are a lot of articles about the topic, but I found this article to be simple an complete.

When I try to start tomcat using eclipse it always fails and complains about port 80 been used. But it is not true.In fact, while eclipse is running and while the error is been shown in the screen I am able to manually start tomcat on port 80.

I have noticed that eclipse complains about port 80 been used when it does not have access rights to that port. I did get the same error before I was not able to manually run tomcat on port 80. The difference is that when I manually run tomcat it did log an access right error, and eclipse complains about the usage of the port.

I have modified the eclipse tomcat launcher to include the option "-Djava.net.preferIPv4Stack=true" and to start tomcat as "authbind --deep start"

But I always get the same error.

If I start eclipse as root them it works fine, so I do believe the problem is related to the access rights on port 80 and not to port to been used.

I do assume that eclipse starts tomcat with the same user rights used to start eclipse.

Could anybody provide some support?. I can work by using port forwarding, but I would really like to know what I am missing and how to do it right.

Was it helpful?

Solution

The easiest way is to start tomcat with a listener on port 8080 and forward port 80 to localhost:8080:

ssh -L 80:localhost:8080 <user>@localhost

Execute this command with sudo

OTHER TIPS

I thing to run something which uses the ports 1-1024 under Linux the process has to have the root privileges.

I am not sure if I can be helpful to anyone, but I solved similar problem as described: I started tomcat with startup.sh script, it was working fine on port 80. I restarted machine (just in case) and tried starting the same tomcat from eclipse, but when I got error about port 80 being used.

Turns out eclipse does not take startup scripts from tomcat installation, so it does not use the authbind configuration. The best solution I came up with is to start eclipse with authbind:

    authbind --deep ./STS

As to why this didn't work:

I have modified the eclipse tomcat launcher to include the option "-Djava.net.preferIPv4Stack=true" and to start tomcat as "authbind --deep start"

As I understand you tried passing "authbind --deep start" as arguments to tomcat. I believe the point of authbind is to start application authbind with tomcat as argument. I don't see any way to do it in eclipse.

I am also now learning eclipse like u. Even i faced the same problem as you. Then, i changed the port number then server is starting now. To change the port number, u need to double click the Apache Tomcat at servers. Then click on ports and change the HTTP/1.1 port to any four digit number u wish and save it. It will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top