LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 05-29-2007, 05:43 AM   #1
ishaqmalik
LQ Newbie
 
Registered: May 2007
Posts: 8

Rep: Reputation: 0
Is it possible to run two Tomcat servers (one on 8080 and other on 9090)


Hello,

We are using Red Hat Advance Server 4.0, Is it possible that I could run two separate tomcat servers on different ports on the same machine e.g. one of them running on 8080 and the other on 9090?

Regards,
 
Old 05-29-2007, 12:34 PM   #2
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Yes, that is no problem. You can run as many tomcat apps on 1 machine if you like as long as you have the CPU and memory to handle it. However, a cleaner way would be to have multiple aliased ips on the same machine and bind tomcat on those ip addresses so that you can still have it on port 8080.

-twantrd
 
Old 05-30-2007, 12:12 AM   #3
ishaqmalik
LQ Newbie
 
Registered: May 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks... I have edited server.xml (inside tomcat's conf) and replaced all instances of '8080' with '9090', then restarted the server, but when I try to access it through 'localhost:9090' OR '127.0.0.1:9090', it says 'connection refused'.

Here's the output when I run ./startup.sh

[root@servername bin]# ./startup.sh
Using CATALINA_BASE: /usr/bin/tomcat
Using CATALINA_HOME: /usr/bin/tomcat
Using CATALINA_TMPDIR: /usr/bin/tomcat/temp
Using JRE_HOME: /usr/bin/j2sdk1.4.2_06

(I wanted to attach screenshot of the error message too, but I don't see an attachment option here)

Below is my server.xml

Code:
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container", 
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">
  
    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
        maxThreads="150" minSpareThreads="4"/>
    -->
    
    
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 9090
    -->
    <Connector port="9090" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="9090" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    -->           
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the 
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">         
    --> 
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->        

      <!-- The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->

      </Host>
    </Engine>
  </Service>
</Server>
Regards,
 
Old 05-30-2007, 05:41 AM   #4
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
Did you try adding this line to /etc/services
http 90/udp www www-http
http 90/tcp www www-http
go for network and apache daemon restart
 
Old 05-30-2007, 01:08 PM   #5
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Quote:
Did you try adding this line to /etc/services
http 90/udp www www-http
http 90/tcp www www-http
go for network and apache daemon restart
Umm, this is tomcat, NOT apache.

Quote:
Thanks... I have edited server.xml (inside tomcat's conf) and replaced all instances of '8080' with '9090', then restarted the server, but when I try to access it through 'localhost:9090' OR '127.0.0.1:9090', it says 'connection refused'.
First off, do you see that tomcat instance running when you do a 'ps'? Is port 9090 listening? If so, it's probably the server firewall.

-twantrd
 
Old 05-31-2007, 12:01 AM   #6
ishaqmalik
LQ Newbie
 
Registered: May 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Gentlemen, it embarrasses me to state what the problem was, we had an old JVM running, I just upgraded it to latest (JDK6) and now everything works fine... (I don't know how could have I ignored something as naive as this)

Thanks a lot for your suggestions

Regards,
 
Old 06-04-2007, 01:54 AM   #7
ishaqmalik
LQ Newbie
 
Registered: May 2007
Posts: 8

Original Poster
Rep: Reputation: 0
NOTE: Only replacing all occurances of 8080 with 9090 is not enough, one has to change the whole set of ports along with some editing in startup.sh and shutdown.sh
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
access 8080 web server port through squid running on 8080 sunethj Linux - Networking 11 05-18-2007 02:38 AM
Tomcat: Refused localhost:8080 manudath Linux - Software 1 03-31-2005 03:32 AM
How do you run Tomcat as nobody? vous Linux - Software 11 03-24-2005 01:15 PM
Tomcat, cannot connect to 8080 briansy Linux - Software 2 03-03-2004 06:22 AM
Stopping Tomcat causes java.net.ConnectException and also unable to connect to 8080 simonh Linux - Software 3 07-21-2003 04:49 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 10:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration