tomcat startup error Cannot find /usr/local/tomcat/bin/setclasspath.sh reason

Command in use

./startup.sh

An error is reported when starting tomcat:

Cannot find /usr/local/tomcat/bin/setclasspath.sh
This file is needed to run this program

Let's look at the catalina.sh file in the bin directory of tomcat:

vi catalina.sh

Search for setclasspath:

?setclasspath

Then we locate the searched place:

if $os400; then
  # -r will Only work on the os400 if the files are:
  # 1. owned by the user
  # 2. owned by the PRIMARY group of the user
  # this will not work if the user belongs in secondary groups
  . "$CATALINA_HOME"/bin/setclasspath.sh
else
  if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
    . "$CATALINA_HOME"/bin/setclasspath.sh
  else
    echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
    echo "This file is needed to run this program"
    exit 1
  fi
fi

This error is reported because there is a problem with the configuration of $CATALINA_HOME, which prevents /bin/setclasspath.sh from being found.

solve:

Because $CATALINA_HOME is configured in /etc/profile, we modify /etc/profile:

vi  /etc/profile

Modify the configuration information TOMCAT_HOME and CATALINA_HOME of tomcat to the location of your tomcat file, mine is as follows:

export TOMCAT_HOME=/usr/local/tomcat/apache-tomcat-9.0.40
export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-9.0.40

Setting the environment variable takes effect immediately:

source /etc/profile

Finally start tomcat

Guess you like

Origin blog.csdn.net/qq_33697094/article/details/110520236