In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the causes and solutions of tomcat startup flashback. The explanation in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn the causes and solutions of tomcat startup flashback.
Methods / steps
Next, let me confirm with you the prerequisites for the problem (native version java:1.6.20,tomcat:6.0.32)
1) it is normal to start tomcat in eclipse.
2) various environment variables are configured in the system as follows:
JAVA_HOME:H:\ DevelopTools\ Java\ jdk1.6.0_20
CATALINA_BASE:H:\ DevelopTools\ apache-tomcat-6.0.32
CATALINA_HOME:H:\ DevelopTools\ apache-tomcat-6.0.32
CLASSPATH:.;%JAVA_HOME%;%JAVA_HOME%\ jre\ lib
PATH:.;%JAVA_HOME%\ bin;%CATALINA_HOME%\ bin
Let's analyze the causes of the problem and the solutions:
Enter the installation directory of tomcat (that is, where it is unzipped and placed):
When you see the three bat files circled in red, the process for starting tomcat through startup.bat is: startup- > catalina- > setclasspath- > catalina
If there is an error in one of the three bat files, it will be a startup failure. In order to find out the reason for the flash, we need to see what's in these three files.
Notepad opens startup.bat and finds the last sentence:: end, we know that end means end,: end is a mark, we add a pause (meaning to pause and wait) at the end.
Execute startup.bat again, and you will see that the cmd window flashes by again when we press any key. But this has confirmed that our environment variables are correct.
To see the information in more detail, let's change another sentence: find call "% EXECUTABLE%" start% CMD_LINE_ARGS% and replace the start with run.
Let's take a look at the error message output in the cmd window:
Error occurred during initialization of vm
Could not reserve enough space for object heap
Could not create the java virtual machine
We can generally understand that the vm program exits because the program does not request enough memory during initialization.
So now that we have found the cause of the problem, we can solve the problem: just apply for enough memory.
Do the following: find the following in catalina.bat under Execute The Requested Command
Set JAVA_OPTS replaced this sentence with:
Set JAVA_OPTS=-server-Xms800m-Xmx800m-XX:MaxNewSize=256m
There are many ways to replace the sentence about set JAVA_OPTS, but it's basically the same.
Start startup.bat again and you'll see the picture we've been waiting for.
It started successfully!
[later]
The interpretation of startup.bat, catalina.bat and setclasspath.bat files in Tomcat through the previous three articles
We should have a general understanding of them, and when we encounter specific problems, we can prescribe the right medicine to the case.
Let me summarize a few problems that tomcat often encounters:
1) The JAVA_HOME environment variable is not defined This environment variable is needed to run this program
Analyze the reason: the environment variable JAVA_HOME is not set in the configuration file of tomcat
Solution:
JAVA_HOME=H:\ DevelopTools\ Java\ jdk1.6.0_20 (the specific value should be based on the actual jdk installation path)
CLASSPATH=.;%JAVA_HOME%;%JAVA_HOME%\ jre\ lib
Or explicitly define the JAVA_HOME environment variable
Add the following two sentences to the starting position in the setclasspath.bat:
Set JAVA_HOME=H:\ DevelopTools\ Java\ jdk1.6.0_20
Set JRE_HOME=H:\ DevelopTools\ Java\ jdk1.6.0_20 (the specific value should be based on the actual jdk installation path)
2) The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE
Analyze the reason: the path of jdk, not jre, should be specified in the setting of the environment variable JAVA_HOME.
Solution:
JAVA_HOME=H:\ DevelopTools\ Java\ jdk1.6.0_20 (here is the post-installation path of JDK)
3) error occurred during initialization of vm could not reserve enough space for object heap could not create the java virtual machine
Analyze the reason: the vm program exits because insufficient memory is requested during program initialization
Solution:
Set the application memory of tomcat, find the set JAVA_OPTS under Execute The Requested Command in catalina.bat and replace this sentence with set JAVA_OPTS=-Xms800m-Xmx800m
Or set JAVA_OPTS=-server-Xms800m-Xmx800m-XX:MaxNewSize=256m
Note:-Xms is the initial memory for tomcat startup-Xmx is the maximum memory occupied by tomcat. The above two parameters are related to the access performance of tomcat, but should also be set according to the actual memory situation of the server.
Other problems are no longer listed, and you can solve them yourself when you encounter them in the future.
Thank you for your reading, the above is the content of "the causes and solutions of tomcat startup flashback". After the study of this article, I believe you have a deeper understanding of the causes and solutions of tomcat startup flashback, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.