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

时间:2017-03-06 17:07:14

标签: tomcat catalina

我正在尝试运行一个启动脚本,但是我收到一个错误,CATALINA_HOME包含冒号,我看到它确实存在,但是这是tomcat的路径。

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

我在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

之前有人遇到过这个问题吗?

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

不是直接运行bat文件,而是尝试在该目录中打开一个命令窗口(在按住ctrl键和“在这里打开commad窗口”时右键单击该文件夹,如果您不知道)这样的类型:

catalina.bat run

看看是否有效。

答案 2 :(得分:0)

此消息对我来说同样的问题:

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

解决方案:

  

设置CATALINA_HOME而不使用冒号:,如下所示:

enter image description here

之后,这是工作结果:

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;

因此移除冒号解决了问题。