You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Henry Loke <fs...@yahoo.com> on 2009/11/15 09:26:06 UTC

Problem encounter during setup Virtual Hosting and Tomcat 6.0

Below is a setup according according to tutorial
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

I plan to setup 2 virtual host ie :
1. ren
2. stimpy
( Please refer to the link above for more detail )

Both Virtual Host No War file. Both of them only have the index.jsp ( The
tomcat index file ).
stimpy project is duplicate of ren project.

I just want to try how the virtual host work.

Before Start configuration:
server.xml
=============================================================
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
			   keystoreFile="conf/localhost.jks" keystorePass="password"
			   SSLCertificateFile="conf/localhost.crt" 
               clientAuth="false" sslProtocol="TLS" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>
</Server>
===============================================================

After Change
server.xml
===============================================================
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
			   keystoreFile="conf/localhost.jks" keystorePass="password"
			   SSLCertificateFile="conf/localhost.crt" 
               clientAuth="false" sslProtocol="TLS" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    <Engine name="Catalina" defaultHost="ren">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="ren"  appBase="renapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
	  <Host name="stimpy"  appBase="stimpyapps" />
    </Engine>
  </Service>
</Server>
=============================================================

[IMG]http://i861.photobucket.com/albums/ab175/fsloke/virtualhost.jpg[/IMG]

For context.xml I follow approach 1. 
=====================================================
<Context crossContext="true">
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
=====================================================

web.xml content:
=====================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5">
  <display-name>Welcome to Tomcat</display-name>
  <description>
     Welcome to Tomcat
  </description>
</web-app>
======================================================

The Filestructure as below:

[IMG]http://i861.photobucket.com/albums/ab175/fsloke/virtualhost2.jpg[/IMG]

Everything I had done through the tutorial.

Now I start run the Tomcat.

Browser: http://ren:8080/

[IMG]http://i861.photobucket.com/albums/ab175/fsloke/pagenoFound.jpg[/IMG]

Server not found

May I know what problem?
I already follow exactly the tutorial but can't works according.
Can anyone tell me what I had did wrong?


-fsloke
-- 
View this message in context: http://old.nabble.com/Problem-encounter-during-setup-Virtual-Hosting-and-Tomcat-6.0-tp26357315p26357315.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem encounter during setup Virtual Hosting and Tomcat 6.0

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Henry Loke [mailto:fsloke@yahoo.com]
> Subject: Re: Problem encounter during setup Virtual Hosting and Tomcat
> 6.0

> For context.xml I follow approach 1. 
> <Context crossContext="true">
>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
> </Context>

It's not clear where you have made the above changes.  You should not be changing conf/context.xml unless you want *all* webapps to have the specified attributes.  You would normally create a context.xml file in each webapp's META-INF directory to hold the <Context> element for that webapp.

> The Filestructure as below:
> http://i861.photobucket.com/albums/ab175/fsloke/virtualhost2.jpg

The context.xml file must be in the webapp's META-INF directory, not WEB-INF.

> But the Tomcat manager webapp not working.
> How to enable Tomcat manager webapp for method 1?

You need to place a copy of the manager webapp under each <Host>'s appBase directory.

> May I know what is the content of ROOT.xml?

Whatever you need.  The default ROOT webapp that ships with Tomcat doesn't have one.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem encounter during setup Virtual Hosting and Tomcat 6.0

Posted by Henry Loke <fs...@yahoo.com>.
Hi Peter 

I edited the hosts file as below:
==================================
127.0.0.1       localhost
127.0.0.1		ren
127.0.0.1		stimpy
==================================

It works. But the Tomcat manager webapp not working.
How to enable Tomcat manager webapp for method 1?

Is it Need to use method 2 in order to configure in such Tomcat manager
webapp for each host?

May I know what is the content of ROOT.xml?

I search in the whole folder of tomcat I cannot find the file. :(

Thanks

-fsloke


Peter Crowther wrote:
> 
> 2009/11/15 Henry Loke <fs...@yahoo.com>:
>> Browser: http://ren:8080/
>>
>> [IMG]http://i861.photobucket.com/albums/ab175/fsloke/pagenoFound.jpg[/IMG]
>>
>> Server not found
> 
> Tomcat cannot and does not change your computer's or network's idea of
> what names map to what IP addresses.  Have you changed your hosts file
> or DNS so that the name "ren" maps to your computer's IP address?  If
> you have not changed it, do so now and see if it works.
> 
> - Peter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-encounter-during-setup-Virtual-Hosting-and-Tomcat-6.0-tp26357315p26357667.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem encounter during setup Virtual Hosting and Tomcat 6.0

Posted by Peter Crowther <pe...@melandra.com>.
2009/11/15 Henry Loke <fs...@yahoo.com>:
> Browser: http://ren:8080/
>
> [IMG]http://i861.photobucket.com/albums/ab175/fsloke/pagenoFound.jpg[/IMG]
>
> Server not found

Tomcat cannot and does not change your computer's or network's idea of
what names map to what IP addresses.  Have you changed your hosts file
or DNS so that the name "ren" maps to your computer's IP address?  If
you have not changed it, do so now and see if it works.

- Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org