• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multiple tomcat instances:Need Help

 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Win XP on my machine.

I have installed Jakarta Tomcat in my "C:"

  • C:\jakarta-tomcat-5.5.9


  • My CATALINA_HOME points to above folder.

    Now, I run my "startup.bat" and it works fine.

    Now, the real question, i want to create an instance of it. Based on the other posts, I got some idea, but not sure how much correct it is.(I tried with the posts related to this issue,but somehow not helpful)

    What i did is i
    1) Created a "local" folder, inside the C:\jakarta-tomcat-5.5.9
    So my folder structure looks like C:\jakarta-tomcat-5.5.9\local
    Above folder is for "instance"
    2)Created "conf","webapps","logs","temp","work".These folders are created within the "local" folder
    3)I copied the "server.xml" and "web.xml" from the already existing folder
    4)edited the "server.xml", with SHUTDOWN "port" and "Connector Port."
    5)created a startup.bat and put it in "C:\jakarta-tomcat-5.5.9\local

     
    Sheriff
    Posts: 13411
    Firefox Browser VI Editor Redhat
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    And what happened when you tried to run startup.bat?

    If you want to run multiple instances of Tomcat from the same codebase you'll need to set both the CATALINA_HOME and the CATALINA_BASE environment variables for each instances' environment.

    Disk space is cheap enough these days that most people (that I know of) just keep multiple, full, tomcat installs instead of trying to do this.
     
    Maan Suraj
    Ranch Hand
    Posts: 299
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    It gives "can not load server.xml" and then gives invocation target exception.

    Also, as per your suggestion

    Disk space is cheap enough these days that most people (that I know of) just keep multiple, full, tomcat installs instead of trying to do this.



    What value do i need to set for CATALINA_HOME environmental variable for keeping multiple ,full,tomcat installs
     
    Ben Souther
    Sheriff
    Posts: 13411
    Firefox Browser VI Editor Redhat
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    See section (4) from this document:
    http://tomcat.apache.org/tomcat-4.1-doc/RUNNING.txt

    It's from an older version of Tomcat so I'm not sure if it will work with recent builds.
    As I said earlier, these days with disk space being so cheap, it's hardly worth it to go through the trouble of setting this up.
    It's much easier to keep two full, independent copies of Tomcat. Then all you have to do is make sure they are using unique port numbers for the connectors and for the shutdown listener.
     
    Maan Suraj
    Ranch Hand
    Posts: 299
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I had one question on below.

    It's much easier to keep two full, independent copies of Tomcat. Then all you have to do is make sure they are using unique port numbers for the connectors and for the shutdown listener.



    Currently, for my existing tomcat install, i have set my "CATALINA_HOME" environmental variable to "C:\jakarta-tomcat-5.5.9".

    Now say, as per you suggestion, i create an independent copy of Tomcat. Say i create "C:\program files\jakarta-tomcat-5.5.9" . Then what do i need to put in the environmental variables? I mean what entry do i need to have for my CATALINA_HOME variable for this independent Tomcat?
     
    Ben Souther
    Sheriff
    Posts: 13411
    Firefox Browser VI Editor Redhat
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    CATALINA_HOME tells tomcat where it's files are.

    So, make sure each instance has a CATALINA_HOME environment variable that points to where you have Tomcat.

    An easy way to do this is to set CATALINA_HOME right at the top of your startup.bat file.
    This way you know that each Tomcat is reading the right one.


    When I do this on Windows, I use the Windows service installer instead of the bat files.
    This script figures all of this out for you.
     
    Maan Suraj
    Ranch Hand
    Posts: 299
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Now what i do is , For the independent Tomcat instance, I set the path of CATALINA_HOME in startup.bat
    I have set my CATALINA_HOME to "C:\Program Files\jakarta-tomcat-5.5.9", as mentioned below.
    The server starts.




    How do i change the port number?
    Actually i opened my "server.xml",

    Please find below the exceprt from that file


    Since , i wanted this instance of Tomcat to run on "8081" port, i changed above connector port from "80" to "8081".

    However, when i start the server, i see i need to still hit "http://localhost:80" i,e the Default one instead of "http://localhost:8081"
    Please tell me How do i change the port? Where am i wrong above?
     
    Ben Souther
    Sheriff
    Posts: 13411
    Firefox Browser VI Editor Redhat
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Where are you setting CATALINA_HOME?
     
    Maan Suraj
    Ranch Hand
    Posts: 299
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    In my startup.bat (extract) .Please find my previous post for whole file.

    rem Guess CATALINA_HOME if not defined
    set CURRENT_DIR=%cd%
    if not "%CATALINA_HOME%" == "" goto gotHome
    set CATALINA_HOME=%CURRENT_DIR%
    if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
    cd ..
    set CATALINA_HOME=C:\Program Files\jakarta-tomcat-5.5.9
    cd %CURRENT_DIR%

    Please see above in bold. Wont that help?
     
    Ben Souther
    Sheriff
    Posts: 13411
    Firefox Browser VI Editor Redhat
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Does that block of code even get executed if CATALINA_HOME already exists in the environment?

    I would just add it to the very top of the startup.bat file.

    Try adding some echo lines to make sure it's using the one that you intended.
     
    Maan Suraj
    Ranch Hand
    Posts: 299
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Yep got it finally

    I would just add it to the very top of the startup.bat file.


    I did that and now my server listens to port 81 as well.

    Thanks for help Ben
     
    Ben Souther
    Sheriff
    Posts: 13411
    Firefox Browser VI Editor Redhat
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Glad it's working
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic