tomcat:The|tomcat:The selected directory in not a valid Tomcat home

环境

  • Linux/Ubuntu20.04LTS
  • Visual Studio Code
  • Tomcat9.0.48
异常
选择的目录不是Tomcat的目录,vscode下安装tomcat插件,选择tomcat服务目录时,提示选择的不是Tomcat目录,并再次选择时没有任何反应。
The selected directory in not a valid Tomcat home

原因
tomcat的目录权限不足!
方案
  1. 目录权限不足就目录的使用权限,进入到Tomcat的安装目录,这里的安装目录是/usr/local,775 为 rwxr-xr-x, -R 即目录下所有文件权限都一样
lauiji@lauiji-IdeaPad-15sIML-2020:/usr/local$ sudo chmod 755 -R apache-tomcat-9.0.48 [sudo] lauiji 的密码:

  1. 查看权限
lauiji@lauiji-IdeaPad-15sIML-2020:/usr/local$ ll 总用量 56 ... drwxr-xr-x9 root root 4096 6月29 18:04 apache-tomcat-9.0.48/

  1. 进入到Tomcat的目录下执行运作,看是否能运行成功,成功运行则说明现在的权限够了
lauiji@lauiji-IdeaPad-15sIML-2020:/usr/local/apache-tomcat-9.0.48/bin$ ./startup.sh Using CATALINA_BASE:/usr/local/apache-tomcat-9.0.48 Using CATALINA_HOME:/usr/local/apache-tomcat-9.0.48 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.48/temp Using JRE_HOME:/usr Using CLASSPATH:/usr/local/apache-tomcat-9.0.48/bin/bootstrap.jar:/usr/local/apache-tomcat-9.0.48/bin/tomcat-juli.jar Using CATALINA_OPTS: Tomcat started.

如果没有修改端口号的话,即可通过浏览器访问localhost:8080
  1. 关闭服务
lauiji@lauiji-IdeaPad-15sIML-2020:/usr/local/apache-tomcat-9.0.48/bin$ ./shutdown.sh Using CATALINA_BASE:/usr/local/apache-tomcat-9.0.48 Using CATALINA_HOME:/usr/local/apache-tomcat-9.0.48 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.48/temp Using JRE_HOME:/usr Using CLASSPATH:/usr/local/apache-tomcat-9.0.48/bin/bootstrap.jar:/usr/local/apache-tomcat-9.0.48/bin/tomcat-juli.jar Using CATALINA_OPTS: NOTE: Picked up JDK_JAVA_OPTIONS:--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED

  1. 在vscode 下重新选择Tomcat的目录即可,/usr/local/apache-tomcat-9.0.48
【tomcat:The|tomcat:The selected directory in not a valid Tomcat home】【遇上雨季,吃定彩虹】 -- Layuji

    推荐阅读