• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

tomcat启动报错Cannot find usrlocaltomcatbinsetclasspath.sh原因

武飞扬头像
m0_67401920
帮助1

在用命令

./startup.sh

启动tomcat时报错:

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

在tomcat的bin目录下我们看下catalina.sh文件:

vi catalina.sh

搜索下setclasspath:

?setclasspath

然后我们定位到搜索的地方:

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

报这个错是因为$CATALINA_HOME配置的有问题导致无法找到/bin/setclasspath.sh导致的。

解决:

1.因为$CATALINA_HOME是配置在/etc/profile中的,所以我们修改下/etc/profile:

vi  /etc/profile

2.修改tomcat的配置信息TOMCAT_HOME和CATALINA_HOME为自己的tomcat文件位置,我的是下面这样:

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

3.设置环境变量立即生效:

source /etc/profile

4.最后再启动tomcat就好啦

5.如果你的tomcat是使用 docker 安装启动报这个错的话:

docker中此报错的其他解决办法你可以参考其他文章:
Latest image incompatible with old versions of docker engine
Tomcat 9 running on docker - Cannot find /usr/local/tomcat/bin/setclasspath.sh
Tomcat 9 running on docker - Cannot find /usr/local/tomcat/bin/setclasspath.sh

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhghacee
系列文章
更多 icon
同类精品
更多 icon
继续加载