4 Replies Latest reply on Jan 5, 2005 12:02 PM by Stan Silvert

    Use of Tomcat's context.xml versus Use of JBoss's jboss-web.

    karin k Newbie

      Hi,
      I just like to know when I should use Tomcat's context descriptor (context.xml file) and
      when I should use JBoss's jboss-web.xml file.

      My first impression was that the jboss-web.xml should replace
      the Tomcat's specific context.xml (and for some things this
      seems to be correct, like for example the context path (or in
      Jboss terminology context root)).
      Other things seem not to be respected inside the jboss-web.xml file.
      One example is the Manager for Sessions.

      Where should a Session Manager for non distributable sessions be configured when the Tomcat's StandardManager cannot be used or the configuration of the Tomcat's StandardManager must be modified?

      I tried configuring this by placing a context.xml file in the WEB-INF directory and this works fine (at least for the configuration of the Session
      Manager).
      So the following questions are quite open for me:

      Is using Tomcat's context.xml file really the way to do it?
      What would happen if I configure the same things in both files. Which
      setting is respected? E.g. the context path set in the context.xml file
      and in the jboss-web.xml
      Which other settings can respectively must be defined in the context.xml file?
      Is there a way to overwrite the default Session manager of
      all deployed web application on one location (and not per wer app)?


      Any help is appreciated
      Thanx in advance
      Karin



        • 1. Re: Use of Tomcat's context.xml versus Use of JBoss's jboss-
          karin k Newbie

          sorry I missed some important information
          I use Tomcat 5 and Jboss 4
          Regards Karin

          • 2. Re: Use of Tomcat's context.xml versus Use of JBoss's jboss-
            Stan Silvert Master

            Yes, you should use context.xml for configuring the Manager.

            A quick look through the elements of context.xml and jboss-web.xml showed that the only overlap was the context root element. JBoss does not respect that setting for context.xml. You must set it in jboss-web.xml

            As I said, it was a rather quick look. If you know of other overlapping items I will get them checked out.

            If you want to set context.xml params globally you can do so in /jboss-4.0.0/server//deploy/jbossweb-tomcat50.sar/server.xml.

            Hope that helps,

            Stan

            • 3. Re: Use of Tomcat's context.xml versus Use of JBoss's jboss-
              karin k Newbie

              Hi Stan,
              thanks for your answer.
              I do not know exactly how I can define a SessionManager
              globally. I saw that it works, when I configure a Context
              for the root path in the server.xml file inside the Host element.

              For example like this (the configuration makes not a lot sense,
              it is only for the sake of showing how I can overwrite the
              global settings of Tomcat). :

              <Service name="jboss.web"
               className="org.jboss.web.tomcat.tc5.StandardService">
              
               <!-- A HTTP/1.1 Connector on port 8080 -->
               <Connector port="8080" address="${jboss.bind.address}"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true"/>
              
              
               <Engine name="jboss.web" defaultHost="localhost">
              
              
               <Logger className="org.jboss.web.tomcat.Log4jLogger"
               verbosityLevel="WARNING"
               category="org.jboss.web.localhost.Engine"/>
              
               <Host name="localhost"
               autoDeploy="false" deployOnStartup="false" deployXML="false">
              
              <Context path="/">
               <Manager
               className="org.apache.catalina.session.StandardManager"
               pathname="KARINSESSIONS.ser"
               maxActiveSessions="35"
               />
               </Context>
              
              
               </Host>
              
               </Engine>
              
               </Service>
              
              </Server>
              
              

              Is this the correct way to do it? Will this also work for Tomcat 4.1?

              Regards Karin

              • 4. Re: Use of Tomcat's context.xml versus Use of JBoss's jboss-
                Stan Silvert Master

                Yes, that is the correct way to do it for JBoss versions that use Tomcat 5.x (JBoss 3.2.4 and above).

                For Tomcat 4.x (JBoss 3.2.3 and below), you would do it in /jboss-3.2.3/server/default/deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xml. For these older versions, the Tomcat XML seen in service.xml is all imbedded in the jboss-service.xml.

                FYI, you can't use the trick of putting a context.xml file in WEB-INF for Tomcat 4.x.