[CentOS] tomcat still sees jvm version 1.4.2 in Cent OS 5

Sun Jan 6 12:34:42 UTC 2008
Craig White <craigwhite at azapple.com>

On Sun, 2008-01-06 at 01:02 -0800, Isaac Gonzalez wrote:
> i chose to install tomcat during the OS install as well as
> java....however, since I needed to use a different jvm, i used the
> method described in http://wiki.centos.org/HowTos/JavaOnCentOS for Sun
> jdk 1.5.0_13 and it worked fine as I can tell, as using the
> alternatives --config java command, i see both 1.4.2 and 1.5.0
> versions and choosing the 1.5.0 version yields the right version when
> doing a "java -version" command....also doing a "which java" also
> points to the right location for the java 1.5.0 install...everything
> appears fine except that tomcat still sees java 1.4.2 as its jvm
> version...
> I have tried setting the path to JAVA_HOME in the tomcat5.conf as well
> as set the JAVA_HOME & JRE_HOME environment variable as a script
> under /etc/profiles.d....its as if tomcat is ignoring this and still
> using java 1.4.2!
>  
> # /etc/init.d/tomcat5 version
> Server version: Apache Tomcat/5.5.20
> Server built:   Sep 27 2007 12:16:07
> Server number:  5.5.20.0
> OS Name:        Linux
> OS Version:     2.6.18-8.1.15.el5
> Architecture:   i386
> JVM Version:    1.4.2
> JVM Vendor:     Free Software Foundation, Inc.
> 
>  
> # java -version
> java version "1.5.0_13"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_13-b05, mixed mode)
> 
>  
> # alternatives --config java
> There are 2 programs which provide 'java'.
>   Selection    Command
> -----------------------------------------------
>    1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
> *+ 2           /usr/lib/jvm/jre-1.5.0-sun/bin/java
> Enter to keep the current selection[+], or type selection number:
> 
>  
>  
> # set
> BASH=/bin/bash
> BASH_ARGC=()
> BASH_ARGV=()
> BASH_LINENO=()
> BASH_SOURCE=()
> BASH_VERSINFO=([0]="3" [1]="1" [2]="17" [3]="1" [4]="release" [5]="i686-redhat-linux-gnu")
> BASH_VERSION='3.1.17(1)-release'
> COLORS=/etc/DIR_COLORS.xterm
> COLUMNS=80
> CVS_RSH=ssh
> DIRSTACK=()
> EUID=0
> GROUPS=()
> G_BROKEN_FILENAMES=1
> HISTFILE=/root/.bash_history
> HISTFILESIZE=1000
> HISTSIZE=1000
> HOME=/root
> HOSTNAME=app2
> HOSTTYPE=i686
> IFS=$' \t\n'
> INPUTRC=/etc/inputrc
> JRE_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre
> JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre
> LANG=en_US.UTF-8
> LESSOPEN='|/usr/bin/lesspipe.sh %s'
> LINES=24
> LOGNAME=root
> LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'
> MACHTYPE=i686-redhat-linux-gnu
> MAIL=/var/spool/mail/root
> MAILCHECK=60
> OPTERR=1
> OPTIND=1
> OSTYPE=linux-gnu
> PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
> 
>  
> i have tried restarting tomcat many times to no avail and there isn't
> anything that useful in its logs besides the info about tomcat native
> library....what gives here?:
>  
> ---------------------tomcat log----------------------------
> Using CATALINA_BASE:   /usr/share/tomcat5
> Using CATALINA_HOME:   /usr/share/tomcat5
> Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
> Using JRE_HOME:       /usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre
> Created MBeanServer with ID: -9skw1s:fb3cloan.0:app2:1
> 6-Jan-08 12:53:52 AM org.apache.catalina.core.AprLifecycleListener
> lifecycleEvent
> INFO: The Apache Tomcat Native library which allows optimal
> performance in production environments was not found on the
> java.library.path: /usr/lib/gcj-4.1.2
> 6-Jan-08 12:53:52 AM org.apache.coyote.http11.Http11BaseProtocol init
> INFO: Initializing Coyote HTTP/1.1 on http-172.16.85.33-8080
> 6-Jan-08 12:53:52 AM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 403 ms
> 6-Jan-08 12:53:52 AM org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 6-Jan-08 12:53:52 AM org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/5.5.20
> 6-Jan-08 12:53:52 AM org.apache.catalina.core.StandardHost start
> INFO: XML validation disabled
> 6-Jan-08 12:53:53 AM org.apache.catalina.core.ApplicationContext log
> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain:
> [org.apache.webapp.balancer.RuleChain:
> [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string:
> News / Redirect URL: http://www.cnn.com],
> [org.apache.webapp.balancer.rules.RequestParameterRule: Target param
> name: paramName / Target param value: paramValue / Redirect URL:
> http://www.yahoo.com],
> [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL:
> http://jakarta.apache.org]]
> 6-Jan-08 12:53:53 AM org.apache.coyote.http11.Http11BaseProtocol start
> INFO: Starting Coyote HTTP/1.1 on http-172.16.85.33-8080
> 6-Jan-08 12:53:53 AM org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> 6-Jan-08 12:53:53 AM org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/112  config=null
> 6-Jan-08 12:53:53 AM org.apache.catalina.storeconfig.StoreLoader load
> INFO: Find registry server-registry.xml at classpath resource
> 6-Jan-08 12:53:53 AM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 1057 ms
----
set it in /etc/sysconfig/tomcat5

for some reason, changes to /etc/tomcat5/tomcat5.conf are ignored

I suppose if that bothers you, file a bugzilla upstream

Craig