I agree, I don't think it's possible if the war files are in the same directory. But it's easily possible if you keep them in different directories: In your server.xml you need to declare two Service elements, each with an HTTP Connector on a different port, and each with a Host pointing to the two different directories where the war files reside. The Tomcat docs have all the details, but even just studying the server.xml file should make things clearer.
i have also tried that way, i have created two different folder containing different war under webapps, and changed the Server.xml but its not working. Can you please help me into making the changes in the following original Server.xml
We had a long discussion on this several months back. I recommend searching this forum for that thread.
Allowing for my fuzzy memory, however, Tomcat assembles its modules in roughly the following architecture:
A Service "owns" the ports. Each Service defines for its own use a unique set of ports to listen to for HTTP, HTTPS, Tomcat Control and Proxy Tunnelling (for example, Apache-to-Tomcat). These ports are defined in server.xml as Connector elements within the Service element. The OS (no matter which OS) does not permit a given port number to be owned by more than one application, which is why the port set must be unique.
A Host defines a virtual host. You can have more than one if you like. The default one is "localhost". All Hosts within a Service share the same collection of ports.
I may be wrong on this, but I think that TOMCAT_HOME/webapps as a default location for deployed WARs is actually defined by the Host configuration element in server.xml and not hard-wired into Tomcat. Regardless, it's the Service that determines what ports will supply a given Host, and thus a given webapp.
A Context defines a single webapp (WAR). Tomcat has ways of constructing Contexts by default rules if you don't provide one, but all deployed webapps have a Context.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
S. Sule wrote:i have also tried that way, i have created two different folder containing different war under webapps, and changed the Server.xml but its not working. Can you please help me into making the changes in the following original Server.xml
I don't see where you think you have two HTTP Connector elements, or two Service elements, or where you tried to define two different directories. It looks pretty much like the standard server.xml file that comes with Tomcat.
Please reread my previous post, and also the Tomcat documentation I pointed you to.
Please see below my modified Server.xml. I have created two folders PMO and RFPT for my respective war files under webapps folder. still im not able to access these war files on 8080 and 8080 server. Please suggest me the solution after going through server.xml.
I have done the neccessary changes highlighted in green color:
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
<Resource name="UserDatabase" auth="Container"
description="User database that can be updated and saved"
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
<Connector port="8000" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />