6 Replies Latest reply on Mar 2, 2011 4:53 AM by Antoine Brun

    Porting Tomcat webapp to JBoss

    Antoine Brun Newbie

      Hello,

       

      I have a request for advices on how to port a web application that runs on Tomcat to Jboss 5.

       

      Up to now, I haven't been able to figure out how to configure Context in jboss web.

       

      Currently the authentication and authorisation in my Tomcat app is done via Realms.

      Those realms are declared in Context such as:

       

      <Context antiResourceLocking="true" docBase="sesapp" privileged="true"  reloadable="false" cookies="true">

              <Manager className="org.apache.catalina.session.StandardManager"  distributable="false" pathname="" saveOnRestart="false" />

              <Realm className="com.ubiqube.ses.tomcat.realm.SesRealm" />

              <ResourceLink name="jdbc/myoracle" global="jdbc/myoracle"  type="javax.sql.DataSource" />

              <Valve className="com.ubiqube.ses.tomcat.valve.ContextLocaleValve"  language="EN" />

              <Valve className="com.ubiqube.ses.tomcat.valve.ContentEncodingValve" />

              <Parameter name="disablePwdSaving" value="false" />

              <Parameter name="VoipWindowCustomizer" value="com.ubiqube.ses.zk.window.voip.extended.custom.VoipWindowUbiqubeCustomizer"/>

      </Context>

       

      this file is located in <Tomcat_dir>/conf/Catalina/locahost

      and it's called appli1.xml as I want the application to be accessible via the context appli1

       

      As you can see, this Context references the Realm, but also the datasource jndi name, and a few other parameters.

       

      Can you explain me how to port this kind of functionality to a JBoss Web server?

       

      Thanks,

       

      Antoine Brun

        • 1. Porting Tomcat webapp to JBoss
          Jean-Frederic Clere Master

          Put the context.xml in WEB_INF of the webapp.

          • 2. Porting Tomcat webapp to JBoss
            Antoine Brun Newbie

            Thanks, I've tried this, it works.

            Now I have 2 other questions:

            1. what is I want several contexts to access the same webapp?

            For example to set some specific parameters, or specific realm

             

            2. the realm class I use for the context is packaged in a jar located in the WEB-INF/lib of my webpp.

            But when I deploy the webapp, I get a class not found exception for this class.

            Do you know the best way to package the realm class?

            There seems to be a classloading issue there but I don't know how to fix it.

            I could put the jar in my jboss/server/default/lib dir, but then my webapp deployment would not be as clean as I'd like

             

            Thanks,

             

            Antoine

            • 3. Porting Tomcat webapp to JBoss
              Jean-Frederic Clere Master

              1- Well that looks like a different webapp. I would just use different web.xml and war for each.

               

              2 - Could you post the stack trace.

              • 4. Porting Tomcat webapp to JBoss
                Antoine Brun Newbie

                Jean-Frederic Clere wrote:

                 

                1- Well that looks like a different webapp. I would just use different web.xml and war for each.

                Actually, we have another Tomcat webapp with one war and several contexts and this is the functionallity I'd like to have on jboss.

                • 6. Re: Porting Tomcat webapp to JBoss
                  Antoine Brun Newbie

                  Are you saying that there is no way to have this kind ot Context configuration:

                   

                  in a Context1.xml file in tomcat/conf/Catalina/localhost/

                   

                  <Context antiResourceLocking="true" docBase="sesapp" privileged="true"

                          reloadable="false" cookies="true">

                          <Manager className="org.apache.catalina.session.StandardManager" distributable="false" pathname="" saveOnRestart="false" />

                          <Realm className="com.ubiqube.ses.tomcat.realm.SesRealm" />

                          <ResourceLink name="jdbc/myoracle" global="jdbc/myoracle"       type="javax.sql.DataSource" />

                          <Valve className="com.ubiqube.ses.tomcat.valve.ContextLocaleValve"           language="EN" />

                          <Valve className="com.ubiqube.ses.tomcat.valve.ContentEncodingValve" />

                          <Parameter name="disablePwdSaving" value="true" />

                          <Parameter name="VoipWindowCustomizer" value="com.ubiqube.ses.zk.window.voip.extended.custom.VoipWindowUbiqubeCustomizer"/>

                  </Context>

                   

                  we have several contexts such as the one above and we use Parameters to configure dedicated contexts.