3 Replies Latest reply on Jan 12, 2007 1:04 PM by cococ

    Webapp under root context eg. http://localhost/

    springy

      Hello,

      Can anybody give me some pointers to deploying a webapp under the root context on jboss+tomcat?

      I know its possible on plain old tomcat by editing the config file but is it possible when deploying under jboss without editing config files on the server?

      I've tried creating an ear with this application.xml but it didn't work. It had the context of the war file eg. /pack. Any ideas?


      <display-name>Pack on JBoss</display-name>


      <web-uri>pack.war</web-uri>
      /




      Thanks for any help.

      Tim.

        • 1. Re: Webapp under root context eg. http://localhost/

          By clawing through the source code, I found an undocumented XML element that you can add to jboss-web.xml to explicitly define the path under which the webapp is deployed (which you place in the WEB-INF dir, same as web.xml)


          <jboss-web>
          <context-root>/</context-root>
          </jboss-web>

          not quite sure why this isn't in the DTD or in the JBoss 3 docs ...

          • 2. Re: Webapp under root context eg. http://localhost/
            thanvi

            I have added my.war file under portal.sar. Also have added the jboss-web.xml under my.war to have the root-context as portal. I am not able to access my.war with any URL. Almost tried many combinations.

            Can anyone help me how to use portal context for the web application in the Portal

            • 3. Re: Webapp under root context eg. http://localhost/
              cococ

              There are several ways to do this.

              If your webapp is part of an EAR file, then the webapp's context root can be defined in the EAR's META-INF/application.xml file (see: http://docs.jboss.org/jbossas/guides/webguide/r2/en/html_single/#d0e777).

              <application>
               ...
               <module>
               <web>
               <web-uri>my.war</web-uri>
               <context-root>m</context-root>
               </web>
               </module>
              </application>
              


              If your webapp is not packaged in an EAR, but deployed as just a webapp, then the context-root can be defined in WEB-INF/jboss-web.xml of the webapp.

              <jboss-web>
               <context-root>my</context-root>
              </jboss-web>
              


              You don't typically deploy a webapp inside of a SAR since this is a service archive (at least I'm not familiar with that practice), either wrap the webapp in an EAR, or deploy it singularly.


              Christopher