tomcat:The selected directory in not a valid Tomcat home

Posted 梁雨季

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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-x  9 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

【遇上雨季,吃定彩虹】 -- Layuji

以上是关于tomcat:The selected directory in not a valid Tomcat home的主要内容,如果未能解决你的问题,请参考以下文章

SSH启动Tomcat:The requested resource is not available

/Users/macbook/Library/Developer/Xcode/DerivedData/MapViewDemo: No such file or direc

Nginx报错:nginx: [emerg] open() “/usr/local/nginx/../conf/nginx.conf“ failed (2: No such file or direc

error while loading shared libraries: lib*.so: cannot open shared object file: No such file or direc

解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or direc

[CentOS7]Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or direc