Virtual host in tomcat

i dont know if it is the right forum but i will try
for demo purpose i need to set up 2 virtual hosts in tomcat
its closed network , not connected to the internet
now i tried like million times to fallow simple tutorials about setting up virtual host but with no success
for example i like to set virtual host that will point to tomcat : webapps\tomcat-docs\appdev\sample\web
now this is what i did :
<Host name="www.my.com" appBase="webapps">        <Context path="" docBase="/tomcat-docs/appdev/sample/web"/> </Host>but when i try to serf in IE with www.my.com
its not going noware .... what todo? or what im doing wrong here ?
do i need configure something else ?
maybe on the pc im working on?
help me im getting crazy ...

Since you are using IE I assume you are on Windows. Try adding the following line to your C:\WINDOWS\system32\drivers\etc\hosts file:
127.0.0.1 www.my.com

Similar Messages

  • How to create a new virtual host under tomcat 4.1.x?

    hi all
    i need some help creating a new virtual host under tomcat 4.1.18!
    that's what i do:
    i'm using the web configuration, reacheable by typing "http://localhost:8080" and then clickign administration
    i create a new host
    name: www.class-site.it
    application base: webapps\class-site
    then i create the context:
    document base: webapps\class-site
    path: /
    and nothing works!!!
    anyone could help me?
    if needed i can also post the server.xml file
    thanx in advance for your help
    sandro

    It should look like this
    <Host name="myvhost.com" debug="0" appbase="/my/path/to/webapps" unpackWars="true">
    <Context path ="" docBase="ROOT" debug="0"/>
    </Host>
    This should be inside the <Engine> tags. You should be able to access a page by going to
    http://myvhost.com:8080/index.jsp
    Obviously you need index.jsp in /my/path/to/webapps/ROOT/index.jsp
    Hope that helps

  • Tomcat virtual hosts

    Hello,
    I have dedicated server (XEN) with lvm partitions and created 3 virtual private servers with OS=centOS enterprise linux 5.x.
    on vps(s) apache-tomcat-6.0.18 installed with tomcat-connectors-1.2.27
    I want to create virtual hosts for tomcat. read some articles and created successfully on my pc tomcat-5.x.x but I am not finding on the server some folders of the tomcat i.e. common, shared and conf/Catalina/ to create virtual hosts according to some articles. I made these folders on the server but not working.
    Kindly let me know how can I create virtual hosts with tomcat-6.0.18
    Thanks & best regards

    farakh wrote:
    [...] but not working. Could you try being any more vague?
    You need to provide a lot more details. At least tell us what "not working" means. What error messages do you get?
    Learn [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html].

  • Tomcat 4.0.1 & Apache 1.3.22 & mod_webapp & virtual hosts

    I have succesfully been able to get tomcat 4.0.1 and apache 1.3.22 to use mod_webapp in both linux and windows.
    First problem:
    If I don't include a trailing slash, my webapp will not display. Just a 404. mod_dir works on the apache end. Also if I access my context thru tomcat on port 8080, without a trailing slash, it will put one in for me. Only when using mod_webapp, it doesn't seem to work.
    So...
    http://localhost/examples <--- doesn't work
    http://localhost/examples/ <--- works
    Second problem:
    How can I get virtual hosts working with mod_webapp? I've successfully been using mod_jk for a while now with virtualhosts, but there are no instructions on how to do this with mod_webapp. Has anyone been able to do this? Is it even possible? Is there a way to alias a /webapp to '/' or something?
    Any help/suggestions are appreciated,
    Tom

    Unfortunately, Tomcat 4.0.1 use the port number 8180 as default. Just after the installation, you need to test it by typing:
    http://localhost:8180/
    If the index page of Tomcat appears, then you succeed.
    On linux platform the webapps directory need to be downloaded for a separate package. For downloads, please visit here:
    http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.1/rpms/tomcat4-webapps-4.0.1-1.noarch.rpm
    Such webapps should be installed in {TOMCAT_HOME}/webapps. After all, just restart the Tomcat server (as I know) and see the results by typing:
    http://localhost:8180/
    Click on the link to see further examples.
    Good luck!

  • Virtual hosts in stand alone tomcat

    I have tomcat installed and i am trying to configure virtual hosts.
    What i need is something like:
    http://test1:8080/index.jsp for one aplication and
    http://test2:8080/index.jsp for another.
    Both applications are in a "web" directory outside webapps (at the same level)
    This is part of my server.xml file:
    <Service name="Catalina">    <Connector port="8080" maxHttpHeaderSize="8192"               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"               enableLookups="false" redirectPort="8443" acceptCount="100"               connectionTimeout="20000" disableUploadTimeout="true" />     <Engine name="Catalina" defaultHost="test1">       <Host name="localhost" appBase="webapps"       unpackWARs="true" autoDeploy="true"       xmlValidation="false" xmlNamespaceAware="false">      </Host>          <Host name="test1" appBase="web/test1" debug="0" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">               <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"  prefix="test1_log." suffix=".txt" timestamp="true"/>               <Context path="" docBase="."/>          </Host>          <Host name="test2" appBase="web/test2" debug="0" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">               <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"  prefix="test2_log." suffix=".txt" timestamp="true"/>               <Context path="" docBase="."/>          </Host>    </Engine>   </Service>Really, i can�t get it to work, can someone please assist me here?
    Thanks in advance

    Sorry for the formatting, here it goes the xml:
      <Service name="Catalina">
        <Engine name="Catalina" defaultHost="localhost">
          <Host name="localhost" appBase="webapps"
           unpackWARs="true" autoDeploy="true"
           xmlValidation="false" xmlNamespaceAware="false">
          </Host>
         <Host name="test1" appBase="web/test1" debug="0" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
            <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"  prefix="test1_log." suffix=".txt" timestamp="true"/>
             <Context path="" docBase="."/>
         </Host>
         <Host name="test2" appBase="web/test2" debug="0" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
            <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"  prefix="test2_log." suffix=".txt" timestamp="true"/>
             <Context path="" docBase="."/>
         </Host>
        </Engine>
      </Service>

  • Apache server - tomcat - jk, virtual hosts, database/context.xml question?

    Hello,
    I have an web application that runs perfectly in Tomcat 5.5 when running tomcat stand-alone.
    I also have Apache HTTP server integrated with Tomcat using the jk connector and running virtual hosts in a mod_jk.conf file, which is working for html files. When I run apache and tomcat at the same time, the jsp opens but the servlet cannot get a database connection.
    To run virtual hosts and apache and tomcat, I added this host container to server.xml:
    <Host name="www.mydomain.com" debug="0" appBase="d:/WebApps/mydomain"
    unpackWARs="true" autoDeploy="true">
    <Context path="" docBase="" debug="0"/>
    </Host>
    Does anybody see anything wrong with this? Is there some reason why the context.xml (which contains the database info) is not being read?
    Any suggestions are greatly appreciated.
    Thank you,
    Logan

    Hi,
    In the docmentation of Tomcat 5.x is written that is not recommended to put <context> element in the server.xml file. Create a file in CATALINA_HOME/conf/Catalina/www.mydomain.com/ with an XML extension. For example context.xml. In files like this you should write all of your <context> elements.

  • Problem getting db connection when using virtual hosts / tomcat / apache

    Hello,
    I have servlets that use a connection pool to query an oracle database. When running Tomcat 5.5 stand-alone, everything works fine. But the same servlets do not work when running them on a server tomcat and apache integrated with jk and using virtual hosts. The problem is the connection pool, because servlets not using the pool also work fine.
    Does anybody have any idea why this is happening?
    Thank you.
    Logan

    Hi Saish,
    Thank you for helping.
    Try connecting with the machinen's IP, if this is a viable strategy for you (meaning the database IP is not dynamically assigned).I'm not sure how to do this. Here is a copy of my context.xml:
    <Context path="" docBase="" debug="0">
    <Resource name="jdbc/CraigsList" auth="Container"
    type="javax.sql.DataSource" username="craigslist" password="xxxxxx"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@localhost:1521:GRI"
    maxActive="8" maxIdle="4"/>
    </Context>
    Does this help?
    Thanks.

  • How to get a virtual host name from application in Tomcat?

    Hi,
    Is it possible to obtain the context path and virtual host name at the application (.war file) initialization stage?
    I need to set up these info into my application config table.
    Thanks

    I think it is impossible. It seems the application has no access to the host configuration which it is running in.

  • How to configure multiple virtual hosts for the same context root /

    Hi,
    I am using Glassfish V1 U1 - b14 on Solaris.
    I am trying to configure two applications to be mapped to the / root context, each one in its own virtual host.
    Two things I have noticed:
    1. I have to manually add virtual-hosts="hostId" in domain.xml/application-ref ... looks like just simply deploying the app does not do that although the application is set as default for its particular virtual host. Is this a bug?
    2. Although I have set for each virtual host the default web-app correctly, and they both respond fine, I cannot map both of them to the / context. The second application (chronologically deployed) does not respond when called with the / context ....
    Any ideas? Is this a bug again?
    Regards,
    Rares
    Message was edited by:
    raresp

    Wow, that's a shame. All mighty Application Server and two different apps on two different virtual hosts are considered ambiguous to have the same context root definition.... Fair play to Tomcat and 90% of the rest of servlet containers!
    In my case I have the same EAR we are planning to deploy to many (up to 30) virtual hosts. Faking different context roots for each deployment will bring unnecessary overheads...
    Should I file a bug or feature request?
    Thanks again for your answer, although you're basically saying it is not possible I will wait and look a while for a possible solution before bringing this topic to a conclusion.

  • Virtual Hosts and Mod_JK

    I setup two sites: madplanet.com and j-community.org. Both on all addresses and on port 80. The two domain names resolve to an external IP address. I configured Mod_JK correctly in the httpd.conf file.
    Now I configured two workers in workers.properties each pointing to a different JBoss/Tomcat server. I added them to the workers list and finally added them manually to the appropriate XXXXany_90<domain name>.conf file in the sites directory which looks like this:
    <VirtualHost *:80>
    ServerName madplanet.com
    ServerAdmin [email protected]
    DocumentRoot "/Library/WebServer/Documents"
    DirectoryIndex "index.html" "index.php"
    CustomLog "/var/log/apache2/access_log" "%h %l %u %t \"%r\" %>s %b"
    ErrorLog "/var/log/apache2/error_log"
    ErrorDocument 404 /error/HTTPNOTFOUND.html.var
    <IfModule mod_ssl.c>
    SSLEngine Off
    SSLCertificateFile "/etc/certificates/192.168.0.2.crt"
    SSLCertificateKeyFile "/etc/certificates/192.168.0.2.key"
    SSLCipherSuite "ALL:!ADH:RC4RSA:+HIGH:+MEDIUM:+LOW:!SSLv2:+EXP:eNULL"
    </IfModule>
    <IfModule mod_dav.c>
    DAVLockDB "/var/run/davlocks/.davlockany80default"
    DAVMinTimeout 600
    </IfModule>
    <IfModule modmemcache.c>
    CacheEnable mem /
    MCacheSize 4096
    </IfModule>
    <Directory "/Library/WebServer/Documents">
    Options All -Includes -ExecCGI +MultiViews -Indexes
    AllowOverride None
    <IfModule mod_dav.c>
    DAV Off
    </IfModule>
    </Directory>
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} ^TRACE
    RewriteRule .* - [F]
    </IfModule>
    <IfModule modproxybalancer.c>
    <Proxy "balancer://balancer-group">
    </Proxy>
    </IfModule>
    <IfModule mod_alias.c>
    Alias "/collaboration" "/usr/share/collaboration"
    Alias "/icons/" "/usr/share/httpd/icons/"
    Alias "/error/" "/usr/share/httpd/error/"
    Alias "/examples" "/Library/Tomcat/webapps/examples"
    Alias "/macserver" "/Library/WebServer/Documents"
    </IfModule>
    <IfModule mod_jk.c>
    JKMount / JBoss1
    JKMount /* JBoss1
    </IfModule>
    Include /etc/apache2/httpd_users.conf
    Include /etc/apache2/httpd_groups.conf
    Include /etc/apache2/httpdteamsrequired.conf
    LogLevel debug
    ServerAlias *
    </VirtualHost>
    Still after the web service is started both domains delivery the same content (the one from madplanet.com) meaning that 'http://madplanet.com' and 'http://j-community.org' delivery the same web site. Using the web site port from Tomcat the j-community website comes up fine.
    Any pointers?
    Thanks - Andy

    Your fatal flaw is the line:
    ServerAlias *
    This tells Apache that this virtual host matches all hostnames, so it doesn't matter what site the user tried to access, they will always get the output of this virtual host.
    Remove this line and you should be fine.

  • Remote Virtual Directory with Tomcat

    Does anybody knows if is it possible to set a virtual directory in Tomcat 4.1 or 6.0 in a remote PC ?
    This is the example:
    Mi PC running Tomcat. Mi PC IP: 172.16.8.212.
    There is another PC in the company with another Tomcat running. Let's say in IP 172.16.8.213.
    The public IP is asociated with my PC, and I need that when somebody tries to find certain web application (located in the Tomcat in 172.16.8.213 ) my Tomcat execute the remote application as if it is local.
    Somebody could tell me: "Ok, so why don't you bring the remote application to your local Tomcat, and end with the complications". For some reasons (one of them is security), that's not a choice.
    Thank you very much for any help, and sorry if for my ignorance somebody gets angry.

    A few methods that come to mind off hand would be:
    1) Make an app on your server act as a proxy to the other app. That is, make a Servlet mapped to all URLs in the context. The servlet simply makes a corresponding request to the other server passing all pertinent information from the originating client. Your servlet then reads the response and pipes it directly to the response object
    2) Try setting up a <context> element with the docBase attribute set to the other server's docBase. The other computer would have to give your server read/write access to the directory of interest. Since your server would be actually hosting the application you would have to check on environment and resources to make sure any required settings are duplicated properly.
    3) Have the other application hosted on a different port, and your firewall map that port to their server and your port to your server.

  • Tomcat7 fails can not load virtual host directory [solved]

    I have a new installation of timcat7 setup. The default apps work fine.
    I have a virtual host setup in my home directory but tomcat gies the following erro and it does nto work:
    "SEVERE: Application base [/home/doug/Sites/localcity] for host [localcity] does not exist or is not a directory. deployOnStartUp and autoDeploy have been set to false to prevent deployment errors. Other errors may still occur."
    This is an extract of ls -la of ~/Sites
    drwxrwxr-x  2 tomcat tomcat 4096 Apr 25 12:05 localcity
    I have the exact same setup on a different machine and can not see any differences. Any clue as to what I can do get get this host working?
    I am in the group 'tomcat'.
    Last edited by hypoglycemic (2012-06-05 12:41:54)

    I changed back to the dafault host location of webapps with the examples in it to test if it some larger problem than hosts. It looks liek it is becasue thsi is the log output on start up:
    May 26, 2012 3:07:33 PM org.apache.catalina.core.StandardContext postWorkDirectory
    WARNING: Failed to create work directory [/usr/share/tomcat7/work/Catalina/localcity/manager] for context [/manager]
    May 26, 2012 3:07:34 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [741] milliseconds.
    May 26, 2012 3:07:34 PM org.apache.jasper.EmbeddedServletOptions <init>
    SEVERE: The scratchDir you specified: /usr/share/tomcat7/work/Catalina/localcity/manager is unusable.
    May 26, 2012 3:07:34 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /var/lib/tomcat7/webapps/docs
    May 26, 2012 3:07:34 PM org.apache.catalina.core.StandardContext postWorkDirectory
    WARNING: Failed to create work directory [/usr/share/tomcat7/work/Catalina/localcity/docs] for context [/docs]
    May 26, 2012 3:07:34 PM org.apache.jasper.EmbeddedServletOptions <init>
    SEVERE: The scratchDir you specified: /usr/share/tomcat7/work/Catalina/localcity/docs is unusable.
    May 26, 2012 3:07:34 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /var/lib/tomcat7/webapps/host-manager
    May 26, 2012 3:07:34 PM org.apache.catalina.core.StandardContext postWorkDirectory
    WARNING: Failed to create work directory [/usr/share/tomcat7/work/Catalina/localcity/host-manager] for context [/host-manager]
    May 26, 2012 3:07:34 PM org.apache.jasper.EmbeddedServletOptions <init>
    SEVERE: The scratchDir you specified: /usr/share/tomcat7/work/Catalina/localcity/host-manager is unusable.
    May 26, 2012 3:07:34 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
    May 26, 2012 3:07:34 PM org.apache.jasper.EmbeddedServletOptions <init>
    SEVERE: The scratchDir you specified: /usr/share/tomcat7/work/Catalina/localcity/_ is unusable.
    May 26, 2012 3:07:34 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /var/lib/tomcat7/webapps/examples
    May 26, 2012 3:07:34 PM org.apache.catalina.core.StandardContext postWorkDirectory
    WARNING: Failed to create work directory [/usr/share/tomcat7/work/Catalina/localcity/examples] for context [/examples]
    May 26, 2012 3:07:35 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    May 26, 2012 3:07:35 PM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    May 26, 2012 3:07:35 PM org.apache.jasper.EmbeddedServletOptions <init>
    SEVERE: The scratchDir you specified: /usr/share/tomcat7/work/Catalina/localcity/examples is unusable.
    May 26, 2012 3:07:35 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@6098f192')
    May 26, 2012 3:07:35 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-bio-8080"]
    May 26, 2012 3:07:35 PM org.apache.catalina.startup.Catalina start
    So there is something wrong with the installation itself. I have pacman -R it followed by a -S but the problem remains.
    Is there someway to really super duperly remove the everythign related to tomcat to really truely remove ever trace so that it should rever to normal behaviour?

  • Which J2EE servers and shared virtual hosting

    We currently host our clients websites on an IIS server., using sharded virtual hosting
    I am looking to transfer these clients to a new dedicated server option made available by our hosting supplier. I would like to transfer those sites to a J2EE server that would then run on the new dedicated server.
    My question is, which server to use? I have most expereince with the Sun App Server 8.1 - would the platform edition suffice for this task? i.e. for hosting multiple domains on a single hardware server?
    Is it possible to setup virtual domains for use on the Sun platform edition server? I couldnt find any doc for this kind of thing anywhere.
    Ive trawled google and yahoo and cant seem to find the answers I'm loking for.
    Many thanks.
    C.

    Can I ask what kind of applications you're using
    Tomcat for? The sites I have are all shopping cart
    based, product catalogue etc - nothing too extreme.
    If it were you would you just use servlets for the DB
    accesses?I also have shopping cart and catalog applications. I'm using Hibernate for my database access. The servlets call into Hibernate to read and write to the DB.
    I had read somewhere that using Entity EJBs resulted
    in many more DB hits that were really neccessary, so
    maybe I should just stick to JSPs and servlets.I feel that EJBs have a place but that for smaller sites it can be a bit of overkill. If you're running an amazon.com and you have a cluster of 20 machines upfront with some mongo database in the back then EJBs would be essential. But if you have an installation like I do with a single server talking to a single database and managed by a single person then I feel that the added complexity is more than it is worth.
    For the begginer, J2EE can be a bit of a minefield!Yeah - there is alot to it. And, as we're talking about, the API's are just the first step.

  • A second virtual host is deaf

    Apache 2 and Tomcat 4.0 work together here on an NT as long as httpd.conf sees the Tomcat contexts denoted as a virtual host with the same name as the host : "host1".
    So, I am trying now to use a second virtual host "host2" on my machine "host1".
    I can still reach the contexts on host1 with http://host1/things
    but should this also work? : http://host2/otherthings
    must I give my system 2 (two) ip addresses in order to have a second virtual host? Seems strange.

    yes and the link you posted before does actually mention this fairly important issue
    Of course, you can't just make up names and place them in ServerName or ServerAlias. You must first have your DNS server properly configured to map those names to an IP address associated with your server.i suspect that is you want to test on win network if you don't want to mess about with dns you might be able to do some bejiggery in the LMHOSTS file that would have the same effect.
    if you want to just test virtual hosts in general. one thing that also might work is using machine name(s) as well as the ip's
    for example if the machine is called host1 and has an address of 192.168.100.10 then i think you could set up three sites.
    the "real" (default) site.
    192.168.100.10
    127.0.0.1
    virtual host 1
    host1
    virtual host 2
    localhost
    i think these would work although the last one would only work from the server itself. see virtual hosting uses the host header passed in HTTP so as long as you can have different ones that end up going to the same place you can invent some virtual hosts for testing.

  • Deploying applications to virtual hosts and root contexts on OC4J

    Hi
    Does anyone out there know how to use hostnames other than the default to talk to an OC4J application (live virtual hosts in Apache). I have a server called web.mydomain.com but for a particular website I want to access it as shop.otherdomain.com - the same machine just 2 different DNS entries. I want OC4J to accept requests for both these machines and display a different site depending on which is accessed. This functionality is provided in Tomcat by the &lt;host&gt; construct - but how do you do it in OC4J?
    A secondary question related to this is how to deploy an application to the root context of one of these virtual hosts? The Enterprise Manager interface won't let you map anything to the '/' URL.
    I have read a lot of documentation and found little of relevance (fairly typical). I hope this is just a simple option I have overlooked.
    Thanks,
    Anthony.

    Sorry... Forgot to mention:
    I have read the post about using URL rewriting but this seems like a bit of a fudge. I was wondering if there was a way to do this from the OC4J setup. Preferably through the Enterprise Manager?
    Anthony.

Maybe you are looking for

  • RFC call from NW studio

    hi all,     There is an error when I use SAP Connectivity from NW studio.     1.I can see all the function listed.     2.I choose one function (such as "BAPI_SALESORDER_GETLIST")and then clicked "finish" button.     3.the error box jumped out "<objek

  • Do you have to have a data package with the 3G?

    I was told that the 3G would not work without a data package. Is this true? With the 2G, you could use the phone, mp3, and Wi-Fi without the data package.

  • Explain plan change after partitioning - Bitmap conversion to rowid

    hi gurus, before partitioning the table using range paritioning, for the query, SELECT MEDIUMID           FROM MEDIUM_TB           WHERE CMREFERENCEID =8            AND CONTENTTYPEID = 8            AND CMSTATUSID = 5            AND SUBTYPEID = 99 A.

  • ITunes 11.1.3 doesnt sync iOS 7.0.4. pics

    Hi, since updating to Maverick or iOs 7.0.4 I cannot sync my photo galleries via iTunes.  During the syncing photos are being ignored. When I click on the "Photo" section it just shows the turning circle. I tried a few things such as deleting the iPh

  • Non-Updatable Columns

    Hello Is it possible to conditional make a column non-updateable, but allow updates on other columns in the same region. This is based on an updateable Tabular Form : a user of low authority is not allowed to change the Status column but may update t