This is kind of connected to an earlier post but I didn't want to get
shouted at for hijacking so I started new one, hope this is OK

apache-tomcat-7.0.42 standalone web server
CentOS Linux release 7.2.1511
jdk1.7.0_45 and jdk1.8.0_77

It's a bit complicated I'll try to be brief

On discovering that browsers complained that I was using obsolete
cyphers over https I discovered that running the server against java
1.8 solved the problem.

I'm using a tried and tested init.d script

on my test machine, (Ubuntu Linux 12.10) in the script,
/etc/rc.d/init.d/tomcat7 I changed

JAVA_HOME=/opt/jdk1.7.0_45

to

JAVA_HOME=/opt/jdk1.8.0_77

saved the script and started tomcat under jsvc

The server came up straight away and browsers informed me that I was
using modern up to date ciphers ... hooray, change one line and
everything hums.

So, on the CentOS box I had exactly the same script in exactly the
same place pointing to exactly the same jdk  (/opt/jdk1.7.0_45)

I realise that this CentOS release uses systemd init but if I shut
down tomcat with

# systemctl stop tomcat.service

I can start it manually with the old init.d script. it's quicker  and
I don't have to keep reloading services. It works, Tomcat starts up
and ssllabs give me a big fat F for fail as expected but
I'm running fine with https. browsers still complain (as expected) but
it proves that my SSL config is correct (or as correct as can be
expected given the circumstances).

So, # /etc/rc.d/init.d/tomcat7 stop

change

JAVA_HOME=/opt/jdk1.7.0_45

to

JAVA_HOME=/opt/jdk1.8.0_77

/etc/rc.d/init.d/tomcat7 start ... epic fail

With the messages

Cannot find any VM in Java Home /opt/jdk1.8.0_77
Cannot locate JVM library file

in the tomcat logs

I have set everything I can think of including JAVA_HOME in .bash_profile

[root@vps logs]# java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

[root@vps logs]# echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/lyallex/.local/bin:/home/lyallex/bin:/opt/jdk1.8.0_77/bin

but nothing I do changes anything.

I have copied the start script below fYI

Has anyone seen anything like this before?

Thanks
lyallex

========================= /etc/rc.d/init.d/tomcat7


[root@vps logs]# cat /etc/rc.d/init.d/tomcat7

# chkconfig: - 71 19
# description:  Start up the Tomcat servlet engine.
# use java 7
# JAVA_HOME=/opt/jdk1.7.0_45
# java 8, works on Ubuntu, fails on CentOS
JAVA_HOME=/opt/jdk1.8.0_77
CATALINA_HOME=/opt/apache-tomcat-7.0.42
export JAVA_HOME CATALINA_HOME
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/bin/tomcat-juli.jar
TOMCAT_USER=tomcat
TMPDIR=/var/tmp
PIDFILE=/var/run/tc7/jsvc.pid


RC=0

case "$1" in

  start)

   $CATALINA_HOME/bin/jsvc -user $TOMCAT_USER -home $JAVA_HOME
-Dcatalina.home=/opt/apache-tomcat-7.0.42
-Dcatalina.base=$CATALINA_HOME -Djava.io.tmpdir=$TMPDIR
-Djava.awt.headless=true \
     -Xms512m \
     -Xmx1024m \
     -outfile $CATALINA_HOME/logs/catalina.out \
     -errfile $CATALINA_HOME/logs/catalina.err \
     -pidfile '/var/run/tc7/jsvc.pid' \
     -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
     -Djava.util.logging.config.file=$CATALINA_HOME/conf/logging.properties \
     -cp $CLASSPATH  \
     org.apache.catalina.startup.Bootstrap

    RC=$?

    [ $RC = 0 ] && touch /var/tc7lock/subsys/tomcat
    echo "starting tomcat7 on darkstar with:"
    echo "JAVA_HOME=$JAVA_HOME"
    echo "CATALINA_HOME=$CATALINA_HOME"
    echo "CLASSPATH=$CLASSPATH"
    echo "tomcat started"
    ;;

  stop)

    PID=`cat /var/run/tc7/jsvc.pid`
    kill $PID

   RC=$?

    [ $RC = 0 ] && rm -f /var/tc7lock/subsys/tomcat /var/run/tc7/jsvc.pid
    echo "stopping tomcat7 on darkstar with:"
    echo "JAVA_HOME=$JAVA_HOME"
    echo "CATALINA_HOME=$CATALINA_HOME"
    echo "CLASSPATH=$CLASSPATH"

    echo "tomcat stopped"
    ;;

  *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
exit $RC

[root@vps logs]#

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to