1

Linux isn't my strong suit so bear with me if this seems a little newbish. I have a virtual linux box rented, has CentOS (not sure which version) and Apache with Tomcat 6.

Over the past 24 hours, the Tomcat process failed and will not start again. I don't know why, because it had been working fine and I made no changes to the server operation (no updates or new software of anything)

The following information is available to me, but unfortunately does not point me to a solution:

When I try to start the tomcat6 service (service tomcat6 start) it says OK, but when I check its status, (service tomcat6 status) it says "PID file exists, but process is not running"

The catalina.out file records something like this each time I try to start it: /usr/sbin/tomcat6/: line 30: -Duser.language=en: command not found (sometimes the 30 will be a 60).

Edited to Add: the new/relevant events in catalina.out are:

/usr/sbin/tomcat6: line 60: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 60: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 60: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 60: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 60: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 60: -Duser.language=en: command not found
/usr/sbin/tomcat6: line 30: -Duser.language=en: command not found

In /var/log/tomcat6-initd.log I see the following complaint:

/usr/sbin/tomcat6: error: Failed to set JAVACMD. 

The full log of this file is:

/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD
/usr/sbin/tomcat6: error: Failed to set JAVACMD

No other logs have been updated since this started

I've tried restarting the machine, both through an online console and in a PuTTy session, and I've tried deleting the tomcat process id file (saw that somewhere someone had what looked like a similar problem) none of it worked, as you can imagine I also tried to start tomcat6 on multiple occasions, each time with no success.

Has anyone seen anything like this? Or might be able to help me figure out what's going on?

Edit: I've also added an extract from /usr/sbin/tomcat6, hope this formats correctly, I believe it's the section of the file that responds if you use service tomcat6 start.

    if [ "$1" = "start" ]; then
  ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \
    -classpath "$CLASSPATH" \
    -Dcatalina.base="$CATALINA_BASE" \
    -Dcatalina.home="$CATALINA_HOME" \
    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
    -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \
    -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \
    org.apache.catalina.startup.Bootstrap start \
    >> ${CATALINA_BASE}/logs/catalina.out 2>&1 &
    if [ ! -z "$CATALINA_PID" ]; then
      echo $! > $CATALINA_PID
    fi
  • Please provide relevant extracts from all of your logs. Copy and paste them into your question, do not tell us what you think they say. – Iain Nov 17 '15 at 12:05
  • Did you mess with /usr/sbin/tomcat6? It seems you have a wrong new line at line 30 – cristi Nov 17 '15 at 12:28
  • I've edited the OP to include log extracts. Apologies, the newlines did not copy properly so they're a little messy. – Sean W. Nov 17 '15 at 12:29
  • Line 30 in /usr/sbin/tomcat6 is: ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ I can post the whole thing if needed. – Sean W. Nov 17 '15 at 12:41
0

/usr/sbin/tomcat6: error: Failed to set JAVACMD

It looks like your system is failing to define JAVACMD which in turn leads to

/usr/sbin/tomcat6: line 60: -Duser.language=en: command not found

because JAVACMD is null the system tries to run -Duser.language=en.

JAVACMD is defined (or not) in /usr/share/java-utils/java-functions

  # Add all sorts of jvm layouts here
  if [ -x "$JAVA_HOME/jre/sh/java" ]; then
    JAVACMD="$JAVA_HOME/jre/sh/java"
  elif [ -x "$JAVA_HOME/bin/java" ]; then
    JAVACMD="$JAVA_HOME/bin/java"
  else
    JAVACMD=`which java 2>/dev/null`
  fi

  if [ ! -x "$JAVACMD" ]; then
    echo "$0: error: Failed to set JAVACMD"
    return 1
  fi

So it seems that you have no valid java command in the places that tomcat is looking.

  • Thanks Iain, that might at least point me in the right direction. But isn't it the whole point that the startup procedure is trying to set JAVACMD? What do you mean when you say "So it seems you have no valid java command in the places that tomcat is looking." Stupid question maybe, but how do I fix this? I looked at that file (usr/share/java-utils/java-functions) and found JAVACMD declared as your code said it should be. – Sean W. Nov 17 '15 at 13:27
  • Please take a moment to read any understand the code that I quoted from the file. It is searching to see if java exists and is executable at a number of locations on your system. It fails to find anything it can use. – Iain Nov 17 '15 at 13:32
  • Apologies again for the newbieness but I think I'm starting to get it. The line [ ! -x "$JAVACMD ]; must be a test to see if JAVACMD is undefined, which unfortunately passes, because attempts to set it in the code above failed. I used the command printenv and find no reference to JAVA_HOME, should I assume that this is also not set for some reason? – Sean W. Nov 17 '15 at 13:58
  • You rock Iain! Looking at that I was able to get it working (and the server functions now) but I had to manually edit that java-functions file to hard-code a java command location to an openjdk that was available. While I'm thrilled that it now works, I'd like to find a more graceful solution - how can I make sure that the preliminaries for this (JAVA_HOME) etc are always in place? – Sean W. Nov 17 '15 at 15:02
  • You had a working system and it stopped working. Something must have changed, that's the problem you really need to solve because right now your system is in an unknown state and you don't know what else is broken. – Iain Nov 17 '15 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.