Forums Register Login

How to update Tomcat's JVM in Linux?

+Pie Number of slices to send: Send
Ok, I finally found out where to update the new JDK I installed into linux (/etc/bashrc). Thanks to all for all the suggestions.

I now get 1.5.0_08 with a java -version at the linux prompt.

The huge problem remains, however, that if I start the browser with a out.println("Version = " + System.getProperty('java.version') command, I still get 1.4.2.

All the environment variables seem to be correct. I've also restarted both apache and tomcat.

Here are the environment variables:

JAVA_HOME = /usr/java/1.5.0_08
CLASSPATH => points to Java 5, not 1.4.2
CATALINA_HOME -> points to Tomcat 5.0.3x

Clearly, I'm still missing something simple (hopefully), right?

What do I need to do to finally tell Tomcat under Linux to use the new JDK?

Thanks again in advance.

-- Mike

[ EJFH: Removed inadvertent "strikethrough" that may have been intended as an emoticon. ]
[ September 14, 2006: Message edited by: Ernest Friedman-Hill ]
+Pie Number of slices to send: Send
Restarted it how -- how is it running? Via an /etc/init.d script, or just launched by hand? If it's via an init script, you should go look at that file and make sure it's not setting JAVA_HOME for you.

I have to admit that precisely which files bash reads when it starts up, and in what order, is something of a mystery to me, mainly because the answer is totally different depending on whether bash is started as a login shell, an interactive non-login shell, a non-interactive shell, and whether the UID and EUID are equal or unequal! As a result, this is only a gut feeling rather than an absolute fact, but my guess is that /etc/bashrc won't be read by an init script, and adding the appropriate JAVA_HOME definition to /etc/profile will fix this problem.
+Pie Number of slices to send: Send
Tomcat is running automatically. I've restarted it several times using a tool called "Web Host Manager", but that has no effect on the version displayed (1.4.2).

Based on your suggestion, I tried to add the line in /etc/profile like this:

JAVA_HOME = /usr/java/jdk1.5.0_08

but that had no effect.

Hmmmmm

-- M
+Pie Number of slices to send: Send
 


JAVA_HOME = /usr/java/1.5.0_08
CLASSPATH => points to Java 5, not 1.4.2
CATALINA_HOME -> points to Tomcat 5.0.3x
[/QB]



Set JRE_HOME=/usr/java/1.5.0_08
+Pie Number of slices to send: Send
Hi Jason,

JRE_HOME doesn not exist as an environment variable on this server.

How do I print out all the environment variables (on the screen) so I can hopefully spot the one that is still pointing to the 1.4.2 JVM?

Thanks.

-- M
+Pie Number of slices to send: Send
Tomcat uses JRE_HOME only if it exists and is different from JAVA_HOME; it's not often used.

Go see if there's a file names /etc/init.d/tomcat, and if it does, see if it sets JAVA_HOME or directly includes some file that does.
+Pie Number of slices to send: Send
There's no /etc/init.d folder on the server. There is an init.d file, but it's empty.

I used the "printenv" command to look at all the environment variables. They all point to the JDK1.5.0_08 folder.

Do I maybe need to just reboot this server?

Thanks for replies!!!

-- M
+Pie Number of slices to send: Send
Try adding your environment variables directly to the catalina.sh script.




Then restart tomcat.
+Pie Number of slices to send: Send
The problem was that the startomcat file in /usr/sbin was setting the path to the old one. I finally found this file!

Thanks for all your help!!!

-- M
+Pie Number of slices to send: Send
I am curious what distribution are you using??

I wanted to point a few things 1) If you are updating your JVM you should update it for all apps (read for the whole system) provided you won't break something you need like browser plug ins. The reason for that is that you wish to keep current with security patches distributed by your distro of choice when they become available and save yourself the time of reinstalling and reconfiguring again and again after each patch. 2) Tomcat if setup "properly" runs under a separate user in most cases named tomcat too, that is where the environment vars should be changed. Most distributions will use start up scripts to set up the environment for all users before the machine reaches the final runlevel 5 for the X server GUI logins. Also your java version would be linked to something like /usr/bin/java which would point to the currently installed version /usr/local/share/java-XXXX making a change like the one you just did will possibly break that which means that unless you specify the correct path you will be running the wrong JVM version.

Yes I agree linux can seem like a mess but nonetheless pretty much everything is in text files, you can use a find, and follows some pretty good logic for those in the know (which is also ever changing ).

I have been running Tomcat for a while and some operations are a pain so I hope this helps a little bit for future endeavors.
George
+Pie Number of slices to send: Send
Thanks George.

The distro is RedHat 9.

The problem getting the browser part of the server updated was that the JAVA_HOME was being set both in the /etc/bashrc and also in the starttomcat shell sript (oops!). Thus, when tomcat loaded it referred to the old JVM. Changing this variable to /usr/java1.5.0_08 fixed the problem.

Thanks again for your reply.

-- Mike
Grow your own food... or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2397 times.
Similar Threads
Tomcat out of memory with some JREs
Eclipse/Tomcat/Sysdeo
Installation Guide (Tomcat on Linux)
Just learning
Where is Java Set up?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:22:39.