Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 24th, 2007, 07:44 AM
Registered User
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Virtual Hosting Setup Not Working In Tomcat 6

Hey everyone,

I am currently upgrading from Tomcat 4 to Tomcat 6. In version 4 I had several context environments setup like so. However when I use the same setup in the server.xml file of Tomcat 6, all environments get authenticated by the first context I have setup instead of there respective databases. This is no good because each context is for a separate client, anyone know how to set this up properly.

<Context path="/App_1" docBase="App_1" debug="0" reloadable="true" crossContext="true">
<Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
userTable="PPMUser" userNameCol="UserName" userCredCol="UserPassword"
          userRoleTable="PPMUser" roleNameCol="RoleTomcat" />

Heres a overview of my setup.

Client 1: www.domainname.com/app_1
Client 2: www.domainname.com/app_2

The app is being authenticated with a SQL back end, right now in Tomcat 6, first context is handling all the databases authentication - which is not right. Hope someone can help.


Old October 25th, 2007, 11:53 PM
Friend of Wrox
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post

Try by giving seperate context XML files for each context. Like for app_1 you need to have app_1.xml which will be placed under TOMCAT_HOME/conf/Catalina/localhost directory. Each context will have its own context xml and that context xml file will have the <context> tag for it.

- Rakesh
Old December 12th, 2007, 11:26 PM
Registered User
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I am new to tomcat. I also haven't succeeded in setup virtual host in Tomcat6. First I tried with tomcat6 standalone mode.

My $Catalina_home: /usr/share/tomcat6

Following is the section to config virtual hosts in my sever.xml:

        <Host name="biocyberman.com"  appBase="/home/biocyberman/public_html/webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

         <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="virtual_log." suffix=".txt" timestamp="true"/>
        <Context path="" docBase="/home/biocyberman/public_html" debug="0" reloadable="true"/>
       <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="virtual_log." suffix=".txt"
    <Host name="mbio.dom" debug="0"
    <Valve className="org.apache.catalina.valves.AccessLogValve"
    <Context path="" docBase="ROOT" debug="0"/>

This is not successful. My question is:
Is it possible to config a virtual host that all of its files are put out side of $Catalina_home?

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in tomcat working in linux frozen84 Apache Tomcat 1 January 2nd, 2007 01:56 AM
JNDI setup in Embedded Tomcat 5.0.19 Pretty Apache Tomcat 3 July 12th, 2005 06:55 AM
apache virtual server, mod_jk, tomcat 5 curiousmind Apache Tomcat 1 May 17th, 2005 09:44 AM
Virtual Hosting (Simple Query) angrycat Apache Tomcat 2 August 10th, 2004 01:31 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.