无法启动,因为 CATALINA_HOME 包含冒号 (:) 字符

Unable to start as CATALINA_HOME contains a colon (:) character

我正在尝试 运行 一个启动脚本,但我得到一个错误,指出 CATALINA_HOME 包含一个冒号,我看到它确实存在,但那是 [=25= 的路径].

在其他问题中,我看到设置 CATALINA_HOME 的 examples 包含冒号,所以我看不出这里有什么不同。

我在 Windows 机器上,使用 MINGW64 并且我设置了 JAVA_HOME。

$ ./startup.sh
Using CATALINA_HOME:   C:\projects\apache-tomcat-8.5.11
Unable to start as CATALINA_HOME contains a colon (:) character

有人遇到过这个吗?

不要直接 运行 绑定 bat 文件,而是尝试在该目录中打开一个命令 window(在按住 ctrl 键和 "Open commad window here" 的同时右键单击该文件夹,以防万一你不知道)输入这个:

catalina.bat 运行

看看是否可行。

这条消息对我来说是同样的问题:

user@DESKTOP-1I6N4PQ MINGW64 /g/dev
$ catalina.sh
Using CATALINA_HOME:   G:\dev\apache-tomcat-8.5.12-windows-x64
Unable to start as CATALINA_HOME contains a colon (:) character

解法:

Set the CATALINA_HOME without using the colon : like this:

之后,这是工作结果:

user@DESKTOP-1I6N4PQ MINGW64 /g/dev
$ catalina.sh
Using CATALINA_BASE:   \dev\apache-tomcat-8.5.12-windows-x64
Using CATALINA_HOME:   \dev\apache-tomcat-8.5.12-windows-x64
Using CATALINA_TMPDIR: \dev\apache-tomcat-8.5.12-windows-x64/temp
Using JRE_HOME:        C:\Program Files\Java\jdk1.8.0_121
Using CLASSPATH:       \dev\apache-tomcat-8.5.12-windows-x64/bin/bootstrap.jar:\dev\apache-tomcat   -8.5.12-windows-x64/bin/tomcat-juli.jar
Usage: catalina.sh ( commands ... )
commands:
  debug             Start Catalina in a debugger
  debug -security   Debug Catalina with a security manager
  jpda start        Start Catalina under JPDA debugger
  run               Start Catalina in the current window
  run -security     Start in the current window with security manager
  start             Start Catalina in a separate window
  start -security   Start in a separate window with security manager
  stop              Stop Catalina, waiting up to 5 seconds for the process to end
  stop n            Stop Catalina, waiting up to n seconds for the process to end
  stop -force       Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
  stop n -force     Stop Catalina, wait up to n seconds and then use kill -KILL if still running
  configtest        Run a basic syntax check on server.xml - check exit code for result
  version           What version of tomcat are you running?
Note: Waiting for the process to end and use of the -force option require that $CATALINA_PID is d   efined

user@DESKTOP-1I6N4PQ MINGW64 /g/dev
$

注:

catalina.sh 文件中,您会发现:

# Ensure that neither CATALINA_HOME nor CATALINA_BASE contains a colon
# as this is used as the separator in the classpath and Java provides no
# mechanism for escaping if the same character appears in the path.
case $CATALINA_HOME in *:*)  
   echo "Using CATALINA_HOME:   $CATALINA_HOME";
   echo "Unable to start as CATALINA_HOME contains a colon (:) character";
   exit 1;

所以删除冒号解决了问题。

如果您在 Windows 机器上使用 git bash,您仍然需要键入“./startup.bat”而不是“./startup.sh” “