Saturday, March 7, 2009

Jboss and Tomcat port config in Fedora 10

I had face many issues while trying to configure multiple server my fedora machine from outside, like

I have a Fedora 10 machine as a dedicated server, in which I run Jboss and Tomcat server all the time , since there was a conflict between the port of these 2 servers (Both servers use the port 8080 for http), I had to change the port for one server . I decided that I will change the tomcat server port , because it is just a webserver and Jboss is an application server. So I change the server port of Tomcat from 8080 to 9090 (I changed the port in the tomcat server.xml file, This file reside in the folder $CATALINA_HOME\conf\ and restart the server). and I use 9090 for weapps and 8080 for applications .

The next issue that I faced was the issue with the accessing the port from a different machine using the machine IP or name. The http protocol was not able to access the port both 8080 and 9090 , it was blocked by the IP address.

Then I flushed out the iptables in Fedora (use command iptables -F as root), the issue solved, but that was not a permanent solution. You need to flush out iptables when ever you restart your machine. and also all the ports will be open for the outside world and which is not good . Later I found the solution. You have to edit the iptables settings.

open the file /etc/sysconfig/iptables, and add the following line

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9090 -j ACCEPT

Here 8080 is for Jboss and 9090 is for the Tomcat server and thus the issue is solved.

1 comment:

  1. this is not working for us.
    Am I missing something else?
    Thanks,
    Venkat

    ReplyDelete