• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • Last Modified:

Tomcat virtual server addition

Hi

I have Tomcat v5 installed running on port 80 which is my production version.  I wanted to run another version of tomcat on port 8080 for a development version of my code on the same box.

How can I create a virtual server to accomplish this?
0
fareedakhan
Asked:
fareedakhan
  • 2
1 Solution
 
ramazanyichCommented:
add following line into your server.xml just after <Connector port="80"...../> element:
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />

Your server will listen then in ports 80 and 8080
0
 
fareedakhanAuthor Commented:
Thanks!

How can I direct the different ports to different webapp folders?
0
 
ramazanyichCommented:
Ok. Now it is more clear.
So you have following config for a moment (I show only part which is important):
<Server .....>
..
    <Service name="Catalina">
    <Connector port="80"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />
    <Engine name="Catalina" defaultHost="localhost" debug="0">
     ....
      <Host name="localhost" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
        ....
        </Host>
     </Engine>
    </Service>
</Server>

It means that you have a Service which has connector on port 80 and invokes applications for host with appbase on webapps dir.

If you want to have another listener for another appBase directory you should copy element (and subelements) <Service> and change port number of conenctor, name of service and appBase for <Host> element. Example:

   <Service name="Catalinadev">
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />
    <Engine name="Catalinadev" defaultHost="localhost" debug="0">
     ....
      <Host name="localhost" debug="0" appBase="webappsdev"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
        ....
        </Host>
     </Engine>
    </Service>

In that eample appBase will be webappsdev.

 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now