Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34123 > unrolled thread
| Started by | Duncan Idaho <duncan@dunenoemail.com> |
|---|---|
| First post | 2016-04-13 15:04 +0100 |
| Last post | 2016-07-17 11:56 -0700 |
| Articles | 8 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
Java 1.8 and CentOS Duncan Idaho <duncan@dunenoemail.com> - 2016-04-13 15:04 +0100
Re: Java 1.8 and CentOS Nigel Wade <nmw@ion.le.ac.uk> - 2016-04-13 15:42 +0100
Re: Java 1.8 and CentOS Duncan Idaho <duncan@dunenoemail.com> - 2016-04-13 17:33 +0100
Re: Java 1.8 and CentOS Andreas Leitgeb <avl@logic.at> - 2016-04-13 17:29 +0000
Re: Java 1.8 and CentOS Andreas Leitgeb <avl@logic.at> - 2016-04-13 18:14 +0000
Re: Java 1.8 and CentOS Duncan Idaho <duncan@dunenoemail.com> - 2016-04-14 05:18 +0100
Re: Java 1.8 and CentOS Andreas Leitgeb <avl@logic.at> - 2016-04-14 10:44 +0000
Re: Java 1.8 and CentOS Roedy Green <inquiry@mindprod.com> - 2016-07-17 11:56 -0700
| From | Duncan Idaho <duncan@dunenoemail.com> |
|---|---|
| Date | 2016-04-13 15:04 +0100 |
| Subject | Java 1.8 and CentOS |
| Message-ID | <neljen$psq$1@dont-email.me> |
This is probably off topic but I'm running out of ideas
I have 2 systems
1. Ubuntu Linux 12.10
2. CentOS Linux release 7.2.1511
Each system has the following identical setup
/opt/apache-tomcat-7.0.42
/opt/jdk1.7.0_45
/opt/jdk1.8.0_77
/etc/rc.d/init.d/tomcat7
This script starts tomcat as a unix daemon using jsvc
The script is included at the end of this message FYI
At the start of the script I set the version.
JAVA_HOME=/opt/jdk1.7.0_45
I then type
/etc/rc.d/init.d/tomcat7 start
and tomcat runs like a top on both systems
I then change the script thusly
JAVA_HOME=/opt/jdk1.8.0_77
invoking the script on Ubuntu starts the server
invoking the script on CentOS results in the following error message
Cannot find any VM in Java Home /opt/jdk1.8.0_77
Cannot locate JVM library file
If I set up a systemd service on CentOS and start tomcat under java 1.7
# systemctl start tomcat.service
results in a running server
exactly the same service where the java version is 1.8 fails with the
same message
Cannot find any VM in Java Home /opt/jdk1.8.0_77
Cannot locate JVM library file
I believe this message is coming from jsvc but cannot for the life of
me figure out why this is going wrong.
on CentOS
[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
So the vm is there on the path.
Does anyone have any idea how to fix this as for various reasons I need
to get the server running on CentOS against Java 1.8
thanks
Duncan
==============================/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]#
--
Duncan Idaho
[toc] | [next] | [standalone]
| From | Nigel Wade <nmw@ion.le.ac.uk> |
|---|---|
| Date | 2016-04-13 15:42 +0100 |
| Message-ID | <dn745sFpbh0U1@mid.individual.net> |
| In reply to | #34123 |
On 13/04/16 15:04, Duncan Idaho wrote: > > JAVA_HOME=/opt/jdk1.8.0_77 > > invoking the script on Ubuntu starts the server > > invoking the script on CentOS results in the following error message > > Cannot find any VM in Java Home /opt/jdk1.8.0_77 > Cannot locate JVM library file What is actually in /opt/jdk1.8.0_77 on the CentOS system? > > [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 > > So the vm is there on the path. > But not necessarily in /opt/jdk1.8.0_77/bin. /opt/jdk1.8.0_77/bin is on the PATH, but not necessarily being used to locate java. Try: $ which java and follow the links to the actual executable.
[toc] | [prev] | [next] | [standalone]
| From | Duncan Idaho <duncan@dunenoemail.com> |
|---|---|
| Date | 2016-04-13 17:33 +0100 |
| Message-ID | <nels68$7up$1@dont-email.me> |
| In reply to | #34124 |
On 13/04/16 15:42, Nigel Wade wrote: > On 13/04/16 15:04, Duncan Idaho wrote: > >> >> JAVA_HOME=/opt/jdk1.8.0_77 >> >> invoking the script on Ubuntu starts the server >> >> invoking the script on CentOS results in the following error message >> >> Cannot find any VM in Java Home /opt/jdk1.8.0_77 >> Cannot locate JVM library file > > What is actually in /opt/jdk1.8.0_77 on the CentOS system? [root@vps lyallex]# ls -l /opt/jdk1.8.0_77/ total 25916 drwxr-xr-x. 2 tomcat tomcat 4096 Mar 21 05:09 bin -r--r--r--. 1 tomcat tomcat 3244 Mar 21 05:09 COPYRIGHT drwxr-xr-x. 4 tomcat tomcat 4096 Mar 21 05:09 db drwxr-xr-x. 3 tomcat tomcat 4096 Mar 21 05:09 include -rwxr-xr-x. 1 tomcat tomcat 5103536 Dec 22 20:48 javafx-src.zip drwxr-xr-x. 5 tomcat tomcat 4096 Mar 21 05:09 jre drwxr-xr-x. 5 tomcat tomcat 4096 Mar 21 05:09 lib -r--r--r--. 1 tomcat tomcat 40 Mar 21 05:09 LICENSE drwxr-xr-x. 4 tomcat tomcat 44 Mar 21 05:09 man -r--r--r--. 1 tomcat tomcat 159 Mar 21 05:09 README.html -rw-r--r--. 1 tomcat tomcat 525 Mar 21 05:09 release -rw-r--r--. 1 tomcat tomcat 21102856 Mar 21 05:09 src.zip -rwxr-xr-x. 1 tomcat tomcat 110114 Dec 22 20:48 THIRDPARTYLICENSEREADME-JAVAFX.txt -r--r--r--. 1 tomcat tomcat 177094 Mar 21 05:09 THIRDPARTYLICENSEREADME.txt >> >> [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 >> >> >> So the vm is there on the path. >> > > But not necessarily in /opt/jdk1.8.0_77/bin. Er ... where is it then? [root@vps lyallex]# ls -l /opt/jdk1.8.0_77/bin total 772 ... -rwxr-xr-x. 1 tomcat tomcat 7734 Mar 21 05:09 java -rwxr-xr-x. 1 tomcat tomcat 7941 Mar 21 05:09 javac ... [root@vps lyallex]# ls -l /opt/jdk1.8.0_77/jre/bin total 440 ... -rwxr-xr-x. 1 tomcat tomcat 7734 Mar 21 05:09 java ... /opt/jdk1.8.0_77/bin is on > the PATH, but not necessarily being used to locate java. > > Try: > $ which java > and follow the links to the actual executable. [root@vps lyallex]# which java /usr/bin/java /usr/bin/java -> /etc/alternatives/java -> /opt/jdk1.8.0_77/bin/java Obviously something is not configured correctly, I have set JAVA_HOME in my login account (root login is disabled) JAVA_HOME=/opt/jdk1.8.0_77 which propagates to root when I su [root@vps lyallex]# echo $JAVA_HOME /opt/jdk1.8.0_77 Something isn't configured correctly but I have no idea what. It's driving me nuts :-( lyallex -- Duncan Idaho
[toc] | [prev] | [next] | [standalone]
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2016-04-13 17:29 +0000 |
| Message-ID | <slrnngt0mk.456.avl@login.logic.tuwien.ac.at> |
| In reply to | #34123 |
Duncan Idaho <duncan@dunenoemail.com> wrote: > Each system has the following identical setup > /opt/apache-tomcat-7.0.42 > /opt/jdk1.7.0_45 > /opt/jdk1.8.0_77 > /etc/rc.d/init.d/tomcat7 > This script starts tomcat as a unix daemon using jsvc > At the start of the script I set the version. > JAVA_HOME=/opt/jdk1.7.0_45 > /etc/rc.d/init.d/tomcat7 start > and tomcat runs like a top on both systems > I then change the script thusly > JAVA_HOME=/opt/jdk1.8.0_77 > invoking the script on Ubuntu starts the server > invoking the script on CentOS results in the following error message > Cannot find any VM in Java Home /opt/jdk1.8.0_77 > Cannot locate JVM library file You can try to run yor scripts in a specific shell like e.g. that: bash -x /opt/apache-tomcat-7.0.42/bin/startup.sh It should then tell you everything that happened in this script. > $CATALINA_HOME/bin/jsvc -user $TOMCAT_USER -home $JAVA_HOME My somewhat older tomcat here doesn't yet have a "jsvc" in its bin, so I can't tell if that is a script itself or a native binary... If it is a script, then try the bash -x prefix also on that.
[toc] | [prev] | [next] | [standalone]
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2016-04-13 18:14 +0000 |
| Message-ID | <slrnngt39g.456.avl@login.logic.tuwien.ac.at> |
| In reply to | #34127 |
Andreas Leitgeb <avl@logic.at> wrote:
> Duncan Idaho <duncan@dunenoemail.com> wrote:
>> Each system has the following identical setup
>> /opt/apache-tomcat-7.0.42
>> /opt/jdk1.7.0_45
>> /opt/jdk1.8.0_77
>> /etc/rc.d/init.d/tomcat7
>> This script starts tomcat as a unix daemon using jsvc
> My somewhat older tomcat here doesn't yet have a "jsvc" in its bin,
I just installed jsvc directly (sudo apt-get install jsvc # ubuntu here)
and idly called:
$ jsvc -home $JAVA_HOME java.lang.Object
-> Nothing. Probably somewhere an error got logged about
java.lang.Object.main not existing, but I don't care.
$ jsvc -home /some/existing/but/empty/dir java.lang.Object
-> Cannot find any VM in Java Home /some/existing/but/empty/dir
Running the last one with "strace" showed, that it would try
a few locations inside the given java home to find libjvm.so .
Running the exact jsvc invocation as determined with bash -x
(in my previous posting) with "strace" might reveal what's
wrong on CentOS
[toc] | [prev] | [next] | [standalone]
| From | Duncan Idaho <duncan@dunenoemail.com> |
|---|---|
| Date | 2016-04-14 05:18 +0100 |
| Message-ID | <nen5gp$jas$1@dont-email.me> |
| In reply to | #34128 |
On 13/04/16 19:14, Andreas Leitgeb wrote: > Andreas Leitgeb <avl@logic.at> wrote: >> Duncan Idaho <duncan@dunenoemail.com> wrote: >>> Each system has the following identical setup >>> /opt/apache-tomcat-7.0.42 >>> /opt/jdk1.7.0_45 >>> /opt/jdk1.8.0_77 >>> /etc/rc.d/init.d/tomcat7 >>> This script starts tomcat as a unix daemon using jsvc >> My somewhat older tomcat here doesn't yet have a "jsvc" in its bin, > I just installed jsvc directly (sudo apt-get install jsvc # ubuntu here) > > and idly called: > $ jsvc -home $JAVA_HOME java.lang.Object > -> Nothing. Probably somewhere an error got logged about > java.lang.Object.main not existing, but I don't care. > $ jsvc -home /some/existing/but/empty/dir java.lang.Object > -> Cannot find any VM in Java Home /some/existing/but/empty/dir > > Running the last one with "strace" showed, that it would try > a few locations inside the given java home to find libjvm.so . > > Running the exact jsvc invocation as determined with bash -x > (in my previous posting) with "strace" might reveal what's > wrong on CentOS Well this is interesting [root@vps opt]# cd jdk1.7.0_45/ [root@vps jdk1.7.0_45]# find . -name libjvm.so ./jre/lib/i386/server/libjvm.so ./jre/lib/i386/client/libjvm.so [root@vps opt]# cd jdk1.8.0_77/ [root@vps jdk1.8.0_77]# find . -name libjvm.so ./jre/lib/amd64/server/libjvm.so furthermore [root@vps bin]# ./jsvc -home /opt/jdk1.7.0_45 java.lang.Object returns no error to stdout [root@vps bin]# ./jsvc -home /opt/jdk1.8.0_77 java.lang.Object Cannot find any VM in Java Home /opt/jdk1.8.0_77 hmm, err, so then cd /opt/apache-tomcat-7.0.42/bin/commons-daemon-1.0.15-native-src/unix # ./configure Oh FFS, no gcc # yum group install .. # ./configure # make ... /usr/bin/ld: i386 architecture of input file `jsvc-unix.o' is incompatible with i386:x86-64 output ... oh **** wrong processor architecture go and get jdk-8u77-linux-i586.tar unpack, change JAVA_HOME /etc/rc.d/init.d/tomcat7 start Oh joy, Tomcat now runs under Java 1.8 I knew someone here would have the answer. It was a rookie mistake, wrong processor architecture, my excuse is that I'm tired after weeks of doing battle with a new server that uses systemd init as opposed to sysV init.d which is what I'm used to Thanks Andreas -- Duncan Idaho
[toc] | [prev] | [next] | [standalone]
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2016-04-14 10:44 +0000 |
| Message-ID | <slrnngutb7.456.avl@login.logic.tuwien.ac.at> |
| In reply to | #34129 |
Duncan Idaho <duncan@dunenoemail.com> wrote: > Oh joy, Tomcat now runs under Java 1.8 > I knew someone here would have the answer. > > Thanks Andreas You're welcome & thanks for reporting back :-)
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <inquiry@mindprod.com> |
|---|---|
| Date | 2016-07-17 11:56 -0700 |
| Message-ID | <i5lnobddbtg8djqdpdifeuojrihgj9snac@4ax.com> |
| In reply to | #34123 |
On Wed, 13 Apr 2016 15:04:13 +0100, Duncan Idaho <duncan@dunenoemail.com> wrote: >This is probably off topic but I'm running out of ideas If this were a windows problem, I would get you to echo JAVA_HOME and PATH.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web