Welcome to my blog, hope you enjoy reading
RSS

Monday 18 June 2012

creating the hosts in the tomcat server in ubuntu

creating the hosts in the tomcat server in Ubuntu


step1:  In the /var/lib/tomcat6/conf/Catalina path we create folder with hostname 
           example: 'restarant'


step2: In that folder we create the file with name  'ROOT.xml'
           /var/lib/tomcat6/conf/Catalina/restaurant/ROOT.xml


step3: put following code in the ROOT.xml file


           <?xml version='1.0' encoding='utf-8'?>
           <Context displayName="hostname" docBase="/var/lib/tomcat6/webapps/warfilename/"                                                path=""  workDir="work/Catalina/hostname/_">
          </Context>

            example :
           <?xml version='1.0' encoding='utf-8'?>
           <Context displayName="restaurant" docBase="/var/lib/tomcat6/webapps/Restaurant/" path=""
           workDir="work/Catalina/restaurant/_">
          </Context>

step4:  In the /var/lib/tomcat6/conf/server.xml file  host tag(<Host>) data will be re paste in the file after close the host tag(</Host> and change the data in the 
example:

<Host name="hostname"  appBase="webapps/warfilename/"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->

      </Host>

step5: in Filesystem/etc/hosts file add the hostname and localhost port like
example:  127.0.0.1 restaurant


step6: restart the server

step7: In browser enter url like
example:  http://restaurant:8080/(hostname:portnumber)

0 comments: