2 Replies Latest reply on Aug 3, 2009 4:52 PM by Derrick Lin

    Conflict when JBoss AS 5 and Tomcat 5 stand-alone are in the

    Derrick Lin Newbie

      Hi,

      I need to run both JBoss 5 and Tomcat 5 (stand-alone) on the same server and both connect to Apache HTTP server by using mod_jk.

      The mod_jk configuration seems to be correct because request/worker mapping works correctly if I only run either JBoss 5 or Tomcat 5.

      When both servers are running, it maybe cause a conflict, typically, if I try to visit a website hosted by Tomcat, there will be HTTP Status 404, returned by JBoss Web/2.1.1.GA. It could be the other way around if I try to visit a website hosted by JBoss (so Tomcat may return 404). This is not always happen but very often.

      I configured both JBoss and Tomcat server.xml as follow

      #
      #JBOSS AS 5 server.xml
      #
      <Service name="jboss.web">
      
       <!-- A HTTP/1.1 Connector on port 8080 -->
       <Connector protocol="HTTP/1.1" port="8090" address="${jboss.bind.address}"
       connectionTimeout="20000" redirectPort="8453" />
      
       <!-- A AJP 1.3 Connector on port 8009 -->
       <Connector protocol="AJP/1.3" port="8010" address="${jboss.bind.address}"
       redirectPort="8453" />
       <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
      
      ....
       </Engine>
      </Service>
      


      <Server port="8005" shutdown="SHUTDOWN">
      
       <!-- Define the Tomcat Stand-Alone Service -->
       <Service name="Catalina">
      
       <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
       <Connector port="8085" maxHttpHeaderSize="8192"
       maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
       enableLookups="false" redirectPort="8448" acceptCount="100"
       connectionTimeout="20000" disableUploadTimeout="true" />
       <!-- Note : To disable connection timeouts, set connectionTimeout value
       to 0 -->
      
       <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
       <!--
       <Connector port="8443" maxHttpHeaderSize="8192"
       maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
       enableLookups="false" disableUploadTimeout="true"
       acceptCount="100" scheme="https" secure="true"
       clientAuth="false" sslProtocol="TLS" />
       -->
      
       <!-- Define an AJP 1.3 Connector on port 8009 -->
       <Connector port="8009"
       enableLookups="false" redirectPort="8448" protocol="AJP/1.3" />
       <Engine name="Catalina" defaultHost="localhost" jvmRoute="node2">
      
       <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
      
       </Host>
      
       </Engine>
      
       </Service>
      
      </Server>
      
      


      I could not think of anywhere else JBoss and Tomcat would conflict with each other. Any suggestion?

      Thanks~
      Der

        • 1. Re: Conflict when JBoss AS 5 and Tomcat 5 stand-alone are in
          Joshua Davis Expert

          If you had configured the ports in a conflicting way, I would think one of the services wouldn't start. Look in the logs for 'address already in use' messages to confirm that.

          Anyway, this sounds like a mod_jk configuration problem to me. Try connecting to the Tomcat/JBoss instances directly to confirm that.

          • 2. Re: Conflict when JBoss AS 5 and Tomcat 5 stand-alone are in
            Derrick Lin Newbie

             

            "pgmjsd" wrote:
            If you had configured the ports in a conflicting way, I would think one of the services wouldn't start. Look in the logs for 'address already in use' messages to confirm that.

            Anyway, this sounds like a mod_jk configuration problem to me. Try connecting to the Tomcat/JBoss instances directly to confirm that.



            Thanks, HTTP port and the AJP port are the only ports I configured to avoid clash.

            For mod_jk my configuration is as follow (mainly from JBoss wiki)

            <IfModule !mod_jk.c>
             LoadModule jk_module modules/mod_jk.so
            </IfModule>
            
            # Where to find workers.properties
            JkWorkersFile conf/workers.properties
            
            # Where to put jk logs
            JkLogFile logs/mod_jk.log
            
            # Set the jk log level [debug/error/info]
            JkLogLevel info
            
            # Select the timestamp log format
            JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
            
            # JkOptions indicates to send SSK KEY SIZE
            # Notes:
            # 1) Changed from +ForwardURICompat.
            # 2) For mod_rewrite compatibility, use +ForwardURIProxy (default since 1.2.24)
            # See http://tomcat.apache.org/security-jk.html
            JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
            
            # JkRequestLogFormat
            JkRequestLogFormat "%w %V %T"
            
            # Mount your applications
            <VirtualHost *:80>
             ServerName jboss.showmanlkz.com
            
             JkMount /jmx-console loadbalancer
             JkMount /jmx-console/* loadbalancer
            
             JkMount /jbpm-console loadbalancer
             JkMount /jbpm-console/* loadbalancer
            
             JkMount /web-console loadbalancer
             JkMount /web-console/* loadbalancer
            
             JkMount /seam.example.hotel loadbalancer
             JkMount /seam.example.hotel/* loadbalancer
            
             JkMount /seam.example.NumGuess loadbalancer
             JkMount /seam.example.NumGuess/* loadbalancer
            
             JkMount /seam.example.order loadbalancer
             JkMount /seam.example.order/* loadbalancer
            
            </VirtualHost>
            
            <VirtualHost *:80>
             ServerName tomcat.showmanlkz.com
            
             JkMount /mediaapp loadbalancer
             JkMount /mediaapp/* loadbalancer
            
             JkMount /megawrapper loadbalancer
             JkMount /megawrapper/* loadbalancer
            
            </VirtualHost>
            
            # Add shared memory.
            # This directive is present with 1.2.10 and
            # later versions of mod_jk, and is needed for
            # for load balancing to work properly
            # Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
            # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
            JkShmFile run/jk.shm
            
            # Add jkstatus for managing runtime data
            <Location /jkstatus>
             JkMount status
             Order deny,allow
             Deny from all
             Allow from 127.0.0.1
            </Location>


            # Define list of workers that will be used
            # for mapping requests
            # The configuration directives are valid
            # for the mod_jk version 1.2.18 and later
            #
            worker.list=loadbalancer,status
            
            # Define Node1 for JBOSS
            # modify the host as your host IP or DNS name.
            worker.node1.port=8010
            worker.node1.host=localhost
            worker.node1.type=ajp13
            worker.node1.lbfactor=1
            #worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
            #worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
            worker.node1.ping_mode=A #As of mod_jk 1.2.27
            # worker.node1.connection_pool_size=10 (1)
            
            # Define Node2 for Tomcat
            # modify the host as your host IP or DNS name.
            worker.node2.port=8009
            worker.node2.host= localhost
            worker.node2.type=ajp13
            worker.node2.lbfactor=1
            #worker.node2.prepost_timeout=10000 #Not required if using ping_mode=A
            #worker.node2.connect_timeout=10000 #Not required if using ping_mode=A
            worker.node2.ping_mode=A #As of mod_jk 1.2.27
            # worker.node1.connection_pool_size=10 (1)
            
            # Load-balancing behaviour
            worker.loadbalancer.type=lb
            worker.loadbalancer.balance_workers=node1,node2
            
            # Status worker for managing load balancer
            worker.status.type=status
            


            node1 and node2 points to different AJP port already, do I still miss something else??