Start Tomcat from Eclipse in port 80 ( Linux ) - linux

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.

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

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.

Related

Glassfish There is a process already using the admin port 4848

asadmin start-domain domain1
But it shows this error.
There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
I have searched and found that it could be the hostname or that the port is used by an other application or server and actually it is used by TCP.
I have no problem with the hostname so I've tried this solution by changing port.
asadmin set server.http-service.http-listener.http-listener-1.port=10080
but it shows this error
remote failure: No configuration found for server.http-service.http-listener.http-listener-1
Command set failed.
I can't understand why.
Assuming you are running glassifhs under linux
1 - Check if glassfish is already runnig.
ps -ef |grep java
kill any process java relative to glassfish
2 - Check if the port 4848 is in use
netstat -nao |grep 4848
3 - Change the default port
Edit the file {glassfish_home}/config/asadminenv.conf
AS_ADMIN_PORT=4848
I just kill all glassfish processes
pkill -f glassfish
I hit the same error.
This was useful - i.e. check you can ping $(hostname). Looks like glassfish checks hostname against IP, possibly during bind process.
My issue was my hostname/ip address in /etc/hosts was not aligned correctly, meaning I could not ping $(hostname). Once aligned and pinged, glassfish started ok.
I just hit this issue today. Be sure to delete the $PATH/TO/domain1/config/pid and $PATH/TO/domain1/config/pid.prev files as well, if the process isn't running but is being reported as still running.

How to uninstall IIS on windows 8.1 so I can XAMPP on port 80

I installed IIS on my Windows 8.1 computer but now I want to work with XAMPP. At first I got this error:
Problem detected!
9:32:40 PM [Apache] Port 80 in use by "Unable to open process" with PID 4!
9:32:40 PM [Apache] Apache WILL NOT start without the configured ports free!
9:32:40 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
9:32:40 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
I deleted IIS from control panel and unchecked IIS from "Turn Windows features on and off" then I restarted.
But yet when I type localhost in my browser IIS comes up and doesn't let me use XAMPP as my localhost in my project. When I choose XAMPP for my project and run it then I see error 404 because it can't define XAMPP as my localhost.
I want to work with XAMPP, what should I do?
If you unchecked IIS (and all the child nodes) from the "Windows Features" then IIS is gone, so you might have another process using that port. Historically many applications have decided to use that (chats, music players, and others).
I would run netstat as below to find all the processes that are listening/using TCP port 80 and using the PID find in Task Manager who they are:
netstat -ano | findstr :80
There find the PID (last column) and find the culprit. If it is SYSTEM (usually PID 4, and reading your question, that is likely the case, so keep reading) , then some application is using HTTP.sys to listen in Port 80. So for that you'll need to then look in HTTP.sys, for that:
netsh http show servicestate > out.txt
notepad out.txt
there you can find the registered URLs by searching for ":80/" and see if that gives you a clue of who is doing that.

How to check jboss running in redhat environment?

I have installed jboss-eap-6.2.0 in redhat environment and started the server.But i'm not able to access the home page via http://<>:8080 .Here i have to access home using ip address or name like http://<>:8080 its getting time out. So i would like to know what is the problem here and why not to see the jboss home here ?
1.Is there any way to check the server running in putty command line ?
2.Able to install the software connecting via ip but same ip is not allowing to access jboss page .So is firewall blocking the port 8080 ?
Please advise
Open the standalone.xml file from the JBOSS_HOME/standalone/configuration directory.
Look for all the texts jboss.bind.address in there and change the ip with the server's IP address so that you can access it from your local pc.
For example
${jboss.bind.address:192.168.1.68}
${jboss.bind.address.management:192.168.1.68}
... and so on...
Also, you can look for the loop back ip address(127.0.0.1) in the xml file as well and replace it.
Even i faced same issue wheni installed jboss7 on centos machine.i found that 8080 port was being used by some other app,thus disabling jboss7 to use that port.
-you can
telnet localhost 8080 (or) ps -ef|grep java
to check if jboss is running
if its running properly and you still not able to connect through your browser
use nmap to check services running on that port
you can edit your port configuration at
jboss/standalone/configuration/standalone.xml
run jboss again
You need to set the value of the default interface in socket-binding as well in your standalone.xml.

Start Tomcat from Eclipse in port 80 in Ubuntu with Authbind

I have installed Authbind to run Tomcat on port 80 in Ubuntu.
I have followed http://netthink.com/?p=362 to run Tomcat in Ubuntu in port 80.
When I run Tomcat on the command line by typing ./start.sh, Tomcat starts normally on port 80 without any exception.
In order to run Tomcat from Eclipse I installed the Tomcat plugin from http://www.eclipsetotale.com/tomcatPlugin.html. Everything is fine except that when I want to start Tomcat from Eclipse. When I run Tomcat from Eclipse by the Tomcat plugin, I get the following exception:
java.net.BindException: Permission denied :80
And if I add Tomcat as a server in "Server view" in Eclipse and want to start it from Server view I get this exception:
Port 80 required by Tomcat v6.0 Server at localhost is already in use
But I am sure that there is not any process that acquires port 80, because in the same time when I run Tomcat on the command line by typing ./start.sh, Tomcat starts normally on port 80.
How do I run Tomcat from Eclipse on port 80?
Using another port other than 80 and less than 1024 for Tomcat and start it in Server View in Eclipse gave me the same exception. For example, for port 82:
Port 82 required by Tomcat v6.0 Server at localhost is already in use
You said :
But i am sure that there is not any process that acquires port
80,because in the same time when i run Tomcat in command line by
typing ./start.sh ,tomcat starts normally in port 80.
Did you stop Tomcat in command line before starting it with Eclipse ?
To make sure your Tomcat is stopped, type this :
ps -ef|grep tomcat
You should have something like this if Tomcat is stopped :
user 16428 16373 0 13:56 pts/1 00:00:00 grep --color=auto tomcat
try running eclipse as root and then start tomcat (on port 80).. should work. although not an optimal solution. But should work since 80 is a privileged port in linux and requires sudo permissions to run.
You should start eclipse with: authbind --deep eclipse Since eclipse doesn't start tomcat via startup.sh file, inserting authbind there will have no effect.

IIS and Glassfish in Windows 7

I installed the newest version of Windows 7.
This is my development box, so I have glassfish installed, which I use for Java applications. Also, I use IIS to run PHP applications. I run both servers on port 80, but never at the same time.
However, since I set up IIS, I can't get glassfish to run. In eclipse, it always gives the following error:
Port conflict: Please stop the server process using the same port as the one used by the Application Server.
A server process is already running on this port but we cannot determine if it's a GlassFish process (lack of info or credentials).If you do not find something else running on this port, check for antivirus software blocking or monitoring this port.
Edit: I tried turning off IIS, and even turned off the IIS feature. Still no luck.
I also ran netstat, and the following are showing up on ports that glassfish uses:
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 NBSDTVL01574:0 LISTENING
TCP [::]:80 NBSDTVL01574:0 LISTENING
Thanks
This turned out to be an issue with my virtual machine. A fresh copy fixed the issue.
this happen because you select the same port number use by the iis and glashfish, i suggest you configure either of the two to use different port number.

Resources