Two tomcats & two VMs on same box

M

Mike

I have tomcat 4.0 running with jdk 1.4. I tried starting up tomcat 5.5
after installing jdk 1.5 and exporting the later as the JAVA_HOME. It
seems that one VM replaces the other. I assume that you can have only
one version of a VM running on a box. Is that true?
 
D

davidsouther

Mike said:
I assume that you can have only
one version of a VM running on a box. Is that true?

Not at all! You'll just have *huge* headaches with trying to sort them
out. The easiest way I can think of is what I do, put seperate VMs on
seperate boxes on a network. But that may not work for you, so we go
plan b: different user accounts for each VM.
I have tomcat 4.0 running with jdk 1.4. I tried starting up tomcat 5.5
after installing jdk 1.5 and exporting the later as the JAVA_HOME. It
seems that one VM replaces the other.

I'm a Windows guy, so what I'm about to say will be windows-specific,
but shouldn't be that hard to change for *nix.

Zeroith, backup all your personal libraries and uninstall everything
Java/Tomcat realated. It'll save you pains later.

First, create a user account for 1.4/4.0. Install Java to
%user_root%/java, and tomcat to %user_root%/tomcat, or however. Now,
create a second account for 1.5/5.5, and do the same. Here's where
things will get tricky. You don't want both JVMs using the same libs
and bins, but yet there will be some that you don't want to copy over.

So, decide what you want VM specific, and what you want general. Now,
put these in their own directories, eg %user1%/java/lib,
%user2%/java/lib and %super%/java/lib. Here's where we get
Win-specific. Go to System Properties (right-click my computer,
properties) and go to the "Advanced" tab (this is win2k/XP), and click
on "Environment Variables". On the bottom half, find the variable
CLASSPATH. This will be teh universal library for all JVMs, point it at
%super%/java/lib. Switch to one of the user accounts, and go back to
this screen. This time, we'll be setting this variable in the top box.
Click New, add CLASSPATH and point it at %user1%/java/lib. Switch
users, and set it up again for user 2. Now, they *should* all be
playing nicely.

Go into task manager, and view users. All three should be logged in
nicely. Look at runnning processes. You should have two java.exe, one
with each user, and two tomcats (I may be wrong on that, I don't use
Tomcat myself, so I'm not sure the exact process name).

Oh, I forgot; make sure to point each tomcat at it's respective JVM
(%user%/java/jre/bin/java.exe), and make sure they're NOT on the same
port.

Best of luck!

David S
 
L

lordy

I have tomcat 4.0 running with jdk 1.4. I tried starting up tomcat 5.5
after installing jdk 1.5 and exporting the later as the JAVA_HOME. It
seems that one VM replaces the other. I assume that you can have only
one version of a VM running on a box. Is that true?

Certainly on *nix boxes you can have as many JVMs as you like.
On windows you can too - but you have to be careful with the registry
infomation. One option may be to clear registry keys that refer to the
default JVM (this may be doable from the Java Control Panel Applet?)
and make sure JAVA_HOME is set explicitly in each of your tomcat
startup scripts.

Lordy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top