4 Replies Latest reply on Oct 4, 2002 1:08 PM by humps

    Context path in tomcat4 hacked/fixed

    humps

      w.r.t people can't define <Context path="/" docBase=".... in tomcat4 bundled with JBoss. I've messed around with the source and sort of fixed part of it.

      Problem: org.jboss.web.catalina.ConfigHandler doesn't pass everything you would expect from tomcat4-service.xml to the embedded catalina service. People sort of expect tomcat4-service.xml is the replacement of $CATALINA_HOME/conf/server.xml (which many people scratched their head trying to config the bundled version).

      Solution:
      Copied a large chunk of code from org.apache.catalina.startup.Catalina handling Service/Engine/Host/Context in the xml (because its of my interest) to ConfigHandler.java

      I should be attaching the .class, .java here, you only have to add it to tomcat4-service.jar in the correct package.

      BUT!!!! It makes tomcat throw a ServletException because it can't find the JasperServlet from its class loader. The class is found in the jasper jar under $JBOSS_HOME/catalina/lib which I will try to fix. It doesn't seem to break my app though ;p

      If someone is interested in giving a full fix, please do! There should be a lot of config being passed to tomcat, but they're just not supported in the JBoss bundle (ConfigHandler.java).

      If I get a chance to figure out the servelt exception, I'll post another potential hack here. If anyone thinks I should submit it back to JBoss, please advice. Its not a complete fix yet, its only a hack @moment.

      humps

        • 1. Re: Context path in tomcat4 hacked/fixed

          Post your patch at www.sf.net/projects/jboss

          but post it as a diff to the original source
          diff -u OldSource.java NewSource.java

          or if you are in a CVS tree
          cvs diff -u NewSource.java

          See if you can't figure out the Jasper problem first
          though. :-)

          Regards,
          Adrian

          • 2. Re: Context path in tomcat4 hacked/fixed
            derry

            Hello!

            PLEASE don't mess around with these things.

            You can deploy a war to a context-path "/" with following file called "jboss-web.xml" in WEB-INF:
            <?xml version='1.0' encoding='UTF-8' ?>
            <jboss-web>
            <context-root>/</context-root>
            </jboss-web>

            You can set the virtual host your context should be bound to, too. See jboss-web_3_0.dtd for details...

            So you see - there is no need for your patch.

            CU
            Thomas

            • 3. Re: Context path in tomcat4 hacked/fixed

              Hi, Humps,

              Which version are your classes work on? I tried it in the latest version: jboss-3.0.3_tomcat-4.1.12 it does not work. it complains that org.apache.catalina.util.xml.SaxContext and org.apache.catalina.util.xml.XmlAction do not exist.

              • 4. Re: Context path in tomcat4 hacked/fixed
                humps

                sorry, I should have said it earlier.... I'm only hacking on the older JBoss3.0/Tomcat4.0.3 ....

                I'll have a look at the latest source code when I get my hands round them :)