TomCat的启动文件 start.bat 竟然有bug?!是我眼花吗?欢迎围观

偏执的执 2019-01-08 05:09:07
先说 bug:start.bat文件中永远也执行不到红色部分的代码,因为根据这个bat文件的逻辑

执行到 :okHome 时,文件 "%CATALINA_HOME%\bin\catalina.bat" 必然存在啊

这是 start.bat 的全文,大家主要看红色颜色:

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end

:okHome

set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"

rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end

:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

call "%EXECUTABLE%" start %CMD_LINE_ARGS%

:end



各位大神,帮忙看看
...全文
170 3 打赏 收藏 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
偏执的执 2019-01-08
  • 打赏
  • 举报
回复
引用 2 楼 LCL_data 的回复:
他这里 应该双重校验把

上面if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome 校验一次
你说的这里在校验一次

第二次校验是在第一次校验成功的基础上,
你认为第二次校验会不成功吗?
十八道胡同 2019-01-08
  • 打赏
  • 举报
回复
他这里 应该双重校验把

上面if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome 校验一次
你说的这里在校验一次
偏执的执 2019-01-08
  • 打赏
  • 举报
回复
注意:当切换到父目录后,并且将 CATALINA_HOME 的值设为 父目录后,即执行完
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%
这三行后,下面的 :gotHome,一样会执行
内容概要:本文是一篇详尽的Python调用万邦API实战教程,以速卖通关键词搜索接口(aliexpress.item_search)为主线,系统讲解了从注册获取Key、安装requests库、构建请求、参数详解、解析JSON返回值,到数据清洗、翻页采集、去重、导出CSV/Excel,以及提升代码健壮性的完整流程。文章深入剖析了接口的公共参数与业务参数配置方法,解读了复杂的返回结构(包括外层元信息与内层商品数据),并提供了自定义解析、异常处理、重试机制、限流控制等实用代码模板,最后还指导如何将方案迁移到1688、京东、Lazada等其他电商平台。; 适合人群:具备基础Python编程能力,对网络爬虫、自动化数据采集或跨境电商数据分析感兴趣的研发人员、数据分析师或运营人员。; 使用场景及目标:① 实现对速卖通等电商平台的商品数据进行高效、稳定的批量采集,用于选品分析、竞品监控和价格带研究;② 学习如何构建一个健壮、可复用的第三方API调用程序,掌握错误处理、数据清洗和自动化导出的核心技能。; 阅读建议:学习时应结合文档提供的完整可运行脚本,逐步动手实践每个环节,重点关注“常见问题排查手册”中的坑点,并在真实项目中应用所学的错误码判断、数据类型安全转换和额度监控等最佳实践。

81,108

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧