当前位置:网站首页>How to solve the problem of Tomcat booting and crashing
How to solve the problem of Tomcat booting and crashing
2022-08-11 01:57:00 【Yisuyun】
TomcaHow to solve the boot flashback problem
本篇内容介绍了“TomcaHow to solve the boot flashback problem”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
一、Java环境不对,Tomcat required for different versionsJava环境不同.
有时tomcatversion can be installed normally,But it is detected at startupjava If the version is not correct, a black screen will appear in the blink of an eye.例如:tomcat 10.1-M14version availablejava version “1.8.0_131”The installation was successful with the command prompt,When running, the startup black screen flashed by,After searching for a long time, I couldn't find the reason,Recently, the official installation prompt came out to understand that the problem lies in the running needsJava 11 或更高版本环境.
检查JavaWhether the version is suitable for installation,按windows + R 启用cmd命令,打开命令提示符,输入“java -version”,回车,出现jdk版本,
如果不适合,Please install the corresponding one firstJava版本.
当前Java SE Development Kit 最新版本是18.0.1.1
Java SE Development Kit 18.0.1.1
二、环境变量没有配置好
Tomcat需要配置好JRE才能正常运行.一般情况下,The boot splash screen crashes because it cannot be foundJRE路径,That is to say, the environment variable is installedJDKis not configured properly.
检查jdk是否安装,按windows + R 启用cmd命令,打开命令提示符,进入命令提示符,输入“java -version”,回车,出现jdk版本,表示安装成功,Check that the version is appropriate,参考上文Java环境和tomcat版本对应关系.
检测jdkIs there an error in the configuration,可以在tomcat安装目录\bin下,startup.bat文件最后加上pause命令
启动运行tomcat,The black screen will need to press any key to end as shown in the figure:
If it can be shown as normalUsing路径,It means that there is no problem with the environment variable setting,可跳过此步骤.
如发现问题,You can check the relevant environment variable configuration
① 配置环境变量,本机电脑—>属性—>高级—>点击环境变量
②在系统变量里点击新建—>添加变量:
③ 输入变量名,变量值:
变量名:CATALINA_HOME
变量值:c:\00\ tomcat10_021
(变量值为tomcat安装路径,That is, you just unzipped and installed ittomcatthat folder path)
④ 在系统变量里找到Path,双击打开:
新建环境变量,输入:%CATALINA_HOME%\bin
or in the originalpath列表中添加%CATALINA_HOME%\lib;%CATALINA_HOME%\bin
⑤打开cmd,选择以管理员的身份运行:(Windows键+R,输入cmd,回车)
⑥进入tomcat安装位置\bin目录,输入:startup,回车
⑦打开浏览器,输入:http://localhost:8080/
(出现以下页面,证明安装配置成功.)
三、Tomcat端口被占用
Tomcat默认需要使用8080Wait a few ports,如果端口被占用,tomcatIt crashes on startup,At this point, you need to find which process is occupied8080端口.
Actually, you can check it outTomcat终端输出日志,找到Tomcat目录下的logs目录中catalina当天的日志,例如:catalina.2022-05-19.log文件,If you see in the log error message:Address already in use: bind说明是端口占用了.
在cmd中查看8080有没有被占用,找出占用8080端口的进程
按windows + R 启用cmd命令,打开命令提示符,
输入:netstat -ano | findstr “8080”
如果端口没有被占用,A null value will be displayed;
如果你修改过tomca t端口设置,Please find yourstomcat使用端口,例如,曾把tomcat端口修改成9080,此时查询9080The command for port usage is :
输入:netstat -ano | findstr “9080”
显示为9080端口被PID值为15316occupied by the process.
2 Then you can check it in the task managerPIDThe process corresponding to the value process ID:
Click in the Task Manager menu bar【选项】——勾选” 【前端显示】.
Click in the Task Manager menu bar-【查看】-【选择列】中勾选“PID”
发现占用9080端口,PID值为15316的进程为java.exe
3、Determine if the process is useful,如果没有用,Then just right-click to end the process.
或者,Directly enter the end of the command prompt box interfacePID值进程,例如:
要终止PID号为1196的进程,
可输入:Taskkill/PID 1196
If the process is really useful it cannot end,Then consider replacingtomcat使用的端口
打开:Tomcat的安装目录\ conf \ server.xml
找到下面这行代码:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
将8080Change the port to the port address you need,例如,现在改为9080;
<Connector port="9080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
4、在Tomcat目录\bin中找到“startup.bat”启动Tomcat
5、然后打开浏览器,输入:http://localhost:9080,就可以发现Tomcat正常启动了.
除8080端口外Tomcat还会占用8005,8009和8443端口.如果这4ports are already occupied,Can be modified to use other ports.
四、配置文件编码问题
TomcatSeveral related configuration files are called at startup,If it appears inside it is notUTF-8的字符,Or the encoding format when the file was saved was notUTF-8,tomcat编译时就会出错.Double-check even comment lines.
出错现象:
TomcatA black screen flashes when it starts up,查询catalina log日志,The following error message was found:
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
30-May-2022 23:57:18.015 严重 [main] org.apache.catalina.startup.Catalina.start 无法启动服务器,The server instance is not configured
30-May-2022 23:57:44.468 警告 [main] org.apache.catalina.startup.Catalina.parseServerXml 无法从[The path is omitted here\conf\server.xml]Load the server configuration
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效.
分析:
查看相关的conf\server.xml文件,Found out because some code was commented out,Added Chinese description to the code line,So it will be invalidUTF-8 序列字节
解决方法:
Delete Chinese,Change to English or Pinyin annotations.Save file supportUTF-8的格式.
重启tomcatAfter the failure is resolved.
五、Error writing configuration file required at startup
All relevant configuration files are carefully checked,Grammar and other errors will appeartomcatThe phenomenon of flashback after startup.For example if it is set by specificationJAVA_HOME变量名,when the path is set \ 或 / 是否正确,Note that there is no need to add more after the path setting“\” 或者 “;”........
There is no and firewall or otherapp冲突.
如果tomcatIncorrect memory configuration can also resulttomcat闪退(在Catalina文件里,There is an error in the memory configuration),解决办法:Find the statement that configures memory,删除错误,重新配置.
六、Some related files are missing
by accident or otherwise,tomcat 或jdk的一些jar文件被打包成pack格式,造成tomcat start missingjar包,报错NoClassDefFound.
解决:修复jdk,补回jar
七、免安装的tomcat闪退
免安装的tomcat双击startup.bat后,启动窗口一闪而过,而且tomcat服务未启动.
原因:
在启动tomcat是,需要读取环境变量和配置信息,缺少了这些信息,就不能登记环境变量,导致了tomcat的闪退.
解决办法:
1.在已解压的tomcat的bin文件夹下找到startup.bat,右击->编辑.在文件头加入下面两行:
SET JAVA_HOME=D:\Java\jdk1.6.0_10 (java jdk目录)SET TOMCAT_HOME=E:\tomcat-6.0.35 (解压后的tomcat文件目录)
2.同样的.在已解压的tomcat的bin文件夹下找到shutdown.bat,右击->编辑.在文件头加入下面两行:
SET JAVA_HOME=D:\Java\jdk1.6.0_10 (java jdk目录)SET TOMCAT_HOME=E:\tomcat-6.0.35 (解压后的tomcat文件目录)
3.将你要发布/部署的web文件复制到tomcat的webapps目录下.
4.双击startup.bat即可启动tomcat,成功启动.
5.双击shutdown.bat即可停止tomcat.或者在已启动的tomcat窗口中直接ctrl+c也可停止tomcat.
问题,
1. 免安装的tomcat双击startup.bat后,启动窗口一闪而过,而且tomcat服务未启动.
2. The original is sometimes repaired hereweb目录,也会闪退
原因是:在启动tomcat是,需要读取环境变量和配置信息,缺少了这些信息,就不能登记环境变量,导致了tomcat的闪退.
解决办法一:
1. To configure the system environment variables of the computer
(1) 新增系统变量 TOMCAT_HOME=D:\2Software\tomcat-8.5.31\apache-tomcat-8.5.31
(2) 在path 目录中添加 %OMCAT_HOME%\bin
注意: Of course here's yoursJavaThe environment is ready
解决办法二:
1.在已解压的tomcat的bin文件夹下找到startup.bat,右击->编辑.在文件头加入下面两行:
set JAVA_HOME=D:\2Software\Java\jdk-11set TOMCAT_HOME=D:\2Software\tomcat-8.5.31\apache-tomcat-8.5.31
2.同样的.在tomcat的bin文件夹下找到shutdown.bat,右击->编辑.在文件头加入下面两行:
set JAVA_HOME=D:\2Software\Java\jdk-11set TOMCAT_HOME=D:\2Software\tomcat-8.5.31\apache-tomcat-8.5.31
3.将你要发布/部署的web文件复制到tomcat的webapps目录下.
4.双击startup.bat即可启动tomcat,成功启动.
** Sometimes if the startup crashes,Just run it shutdown.bat It can also solve the flashback problem at the next startup
八、修改配置文件setclasspath.bat
有些时候,我们可以通过修改配置文件setclasspath.bat解决tomcat闪退问题
方法:
1、----》进入Tomcat目录----》进入在bin目录
2、----》找到setclasspath.bat文件----》右键点击编辑
3、at the beginning of the file java_home和jar_home specific path settings
4、再次启动Tomcat,执行startup.bat
九、等待更新
A find leadstomcatThe method of the cause of the flashback:
1、windows+R----》输入cmd----》进入命令提示符窗口
2、输入路径----》进入到tomcat的bin目录
3、----》输入catalina.bat run 回车
4、----》查看具体错误信息
Just find the cause of the error,problem-solving can be targeted.
tomcat出错,Everyone's situation will be different due to hardware and software problems,Here are just a few categories of commonly encountered situations,希望能给你一点启发,慢慢来,Make a backup before modifying,The cause will be found to solve the problem.
“TomcaHow to solve the boot flashback problem”的内容就介绍到这里了,感谢大家的阅读.如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
边栏推荐
- 联盛德W801系列5-微信小程序与W801蓝牙通信例程(阅读笔记)
- [Detailed explanation of C data storage] (1) - in-depth analysis of the storage of shaping data in memory
- 如何实现FPGA的可重复性设计
- 如何开展性能测试,你知道吗?
- Section 4-6 of the first week of the second lesson: Appreciation of medical prognosis cases + homework analysis
- 数据库数据采集利器FlinkCDC
- Engineering Design of Single-sided PCB Routing Impedance
- 络达开发---自定义Timer的实现
- Summary of DDL routine operations in MySQL
- 软件测试面试题:性能测试工作?
猜你喜欢
随机推荐
Deep Learning [Chapter 2]
The statistical data analysis, interview manual"
从键入网址到网页显示的详细过程
Is container technology really the savior of environmental management?
Shengxin experiment record (part2)--tf.reduce_sum() usage introduction
TRCX:掺杂过程分析
Sigma开发注意细节
Data Filters in ABP
进程间通信方式(1)无名管道(全CSDN最用心的博主)
惨遭面试官吊打高并发系统设计,回来学习 2400 小时后成功复仇
winform下的富文本编辑器
测试3年,开口就要25k?面试完最多给15k...
Deep Learning【第二章】
进程间通信(IPC)的分类以及通信方式的发展
颠覆性创新招商,链动2+1是个怎么样的制度模式?
软件测试面试题:什么是数据的对立性,有几个层次?
联盛德W801系列5-微信小程序与W801蓝牙通信例程(阅读笔记)
软件测试面试题:Web服务器指标指标?
Please talk about for...in and for...of in JS (below)
MySQL Basics [Part 1] | Database Overview and Data Preparation, Common Commands, Viewing Table Structure Steps