4 Replies Latest reply on May 22, 2002 12:48 PM by sumeer khosa

    Installing a sample servlet on JBoss Catalina

    sumeer khosa Newbie

      Hi,

      I am using JBoss 2.4.4. with Tomcat4.1. I had written a sample servlet which works fine on Tomcat. I access it as http://localhost:8080/servlets/test.
      But once i start JBoss with embedded Catalina, same url doesn't work. I understand i need to do some kind of tweaking in the configuration to make it work. Is there any documentation avalaible for that? What configuration do i need to do?

      Thanks
      Sumeer.

        • 1. Re: Installing a sample servlet on JBoss Catalina
          Julian Gosnell Expert

          You'll need to understand where the webapp's context is coming from (everything between the end of the host:port/ and the beginning of the servlet-mapping spec (found in your web.xml)).

          In standalone TC it is probably held in a configuration file somewhere ??? or maybe it uses the name of your .war ?

          In JBoss, if you are deploying a .war it will be the name of the .war, or be specified in the optional jboss-web.xml. If an.ear it will be in the application.xml (I figure this probably overrides anything in jboss-web.xml).


          I suspect that the context configuration differs between your two deployments.

          If this is not the case then either something really basic has changed like the portnumber or deployment has failed (since you haven't given me much to go on I can't be specific).

          Otherwise perhaps you have different servlet-mapping specs.

          In any case, if you are planning to move webapps around from container to container you should look at this stuff or it will bite you again and again.

          Jules

          • 2. Re: Installing a sample servlet on JBoss Catalina
            Derek Hulley Newbie

            Hi,

            In Tomcat you specify application-level contexts in server.xml.

            If you just drop the war into jboss, then the context will be the name of the war file, eg. ABC.war will have a URL of
            http://localhost:8080/ABC

            If you put the war in an ear file, then you can specify the context in the application.xml. A good example of this comes with JBoss in the form of webtest.ear in the default deploy directory.

            Bye

            • 3. Re: Installing a sample servlet on JBoss Catalina
              sumeer khosa Newbie

              Hi,

              I tried deploying the .war file, which in my case is called sampleTest.war. The message JBoss gives is:

              [INFO,AutoDeployer] Auto deploy of file:/D:/JBTomcat/jboss/deploy/sampleTest.war
              [INFO,J2eeDeployer] Deploy J2EE application: file:/D:/JBTomcat/jboss/deploy/sampleTest.war
              [INFO,J2eeDeployer] Create application sampleTest.war
              [INFO,J2eeDeployer] inflate and install WEB module sampleTest.war
              [INFO,ContainerFactory] Deploying:file:/D:/JBTomcat/jboss/tmp/deploy/Default/sampleTest.war
              [INFO,ContainerFactory] Deployed application: file:/D:/JBTomcat/jboss/tmp/deploy/Default/sampleTest.war
              [INFO,J2eeDeployer] Starting module sampleTest.war
              [INFO,EmbeddedCatalinaServiceSX] deploy, ctxPath=/sampleTest, warUrl=file:/D:/JBTomcat/jboss/tmp/deploy/Default/sampleTest.war/web1005/
              [INFO,EmbeddedCatalinaServiceSX] WebappLoader[/sampleTest]: Deploying class repositories to work directory D:\JBTomcat\catalina\work\localhost\sampleTest
              [INFO,EmbeddedCatalinaServiceSX] StandardManager[/sampleTest]: Seeding random number generator class java.security.SecureRandom
              [INFO,EmbeddedCatalinaServiceSX] StandardManager[/sampleTest]: Seeding of random number generator has been completed
              [INFO,EmbeddedCatalinaServiceSX] ContextConfig[/sampleTest]: Added certificates -> request attribute Valve
              [INFO,EmbeddedCatalinaServiceSX] StandardWrapper[/sampleTest:default]: Loading container servlet default
              [INFO,EmbeddedCatalinaServiceSX] default: init
              [INFO,EmbeddedCatalinaServiceSX] StandardWrapper[/sampleTest:invoker]: Loading container servlet invoker
              [INFO,EmbeddedCatalinaServiceSX] invoker: init
              [INFO,EmbeddedCatalinaServiceSX] jsp: init
              [INFO,J2eeDeployer] J2EE application: file:/D:/JBTomcat/jboss/deploy/sampleTest.war is deployed.

              Finally i tried accessing the servlet as:
              http://localhost:8080/sampleTest
              but this take me to the directory listings of ApacheTomcat. Am still puzzled with the way it works. Any corrections i need to do?

              Thanks
              Sumeer.

              • 4. Re: Installing a sample servlet on JBoss Catalina
                sumeer khosa Newbie

                Thanks for all the help guys. I figured out the solution. It was due one stupid mistake on my side. INstead of accessing as "http://localhost:8080/sampleTest/servlet/sampletest" i was accessing it as "http://localhost:8080/sampleTest/servlets/sampleTest"..:-). It works great now.

                Thanks
                Sumeer.