1、sudo sh ./startup.sh启动
提示:
./startup.sh: /Library/tomcat-9/bin/catalina.sh: /bin/sh: bad interpreter: Operation not permitted
./startup.sh: line 60: /Library/tomcat-9/bin/catalina.sh: Undefined error: 0
不允许操作和catalina.sh为定义
解决步骤:
①执行:ls [email protected] /Library/tomcat-9/bin/startup.sh
提示:-rwxr–[email protected] 1 weichuanchao wheel 1904 Feb 5 19:34 /Library/tomcat-9/bin/startup.sh
com.apple.quarantine 39
说明start.up文件被隔离
②执行:xattr -d com.apple.quarantine /Library/tomcat-9/bin/startup.sh
③startup.sh启动tomcat需要执行catalina.sh
执行:xattr -d com.apple.quarantine /Library/tomcat-9/bin/catalina.sh
2、权限问题:
然后启动tomcat:sudo sh ./startup.sh
localhost:8080 Not Found
解决方法:
tomcat bin 目录下输入:sudo chmod -R 755
显示:usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file …
chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file …
就成功了
关闭:sudo sh ./shutdown.sh
Using CATALINA_BASE: /Library/tomcat-9
Using CATALINA_HOME: /Library/tomcat-9
Using CATALINA_TMPDIR: /Library/tomcat-9/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
Using CLASSPATH: /Library/tomcat-9/bin/bootstrap.jar:/Library/tomcat-9/bin/tomcat-juli.jar
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.rmi/sun.rmi.transport=ALL-UNNAMED
再次启动 sudo sh ./startup.sh
Using CATALINA_BASE: /Library/tomcat-9
Using CATALINA_HOME: /Library/tomcat-9
Using CATALINA_TMPDIR: /Library/tomcat-9/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
Using CLASSPATH: /Library/tomcat-9/bin/bootstrap.jar:/Library/tomcat-9/bin/tomcat-juli.jar
Tomcat started.
至此终于解决!