3. Common problems encountered with Tomcat startup If all goes well, we can see the very familiar Tomcat window. However, for a variety of reasons, we may encounter some problems, the following is a specific analysis of the reasons why Tomcat can not start normally.
3.1 environment variable setting problem If the JDK is not installed on the machine or the environment variable java_home or catalina_home is not set correctly, Tomcat does not start properly.
3.1.1 The following error dialog box means that Windows cannot find the "-djava.endorsed.dirs=" command, and the following black window error is that the JAVA_HOME environment variable should point to the JDK instead of the root directory of the JRE (this example deliberately puts the Java_ Home points to the root directory of the JRE, so this error occurs. In this case, we can reset the environment variable java_home and point to the JDK installation directory.
3.1.2 The following error occurs because the CATALINA_HOME environment variable is not set correctly, causing Tomcat to not start properly. C:/carl>startup Catalina_home c:/ The CATALINA_HOME environment variable is not defined correctly This environment variable are needed to run this program
3.1.3 The following error is due to incorrectly set the Java startup Parameters xms256m, the correct way to write should be-xms256m, please note the case. As you know, in the Java command line,-XMS represents the amount of memory allocated when the JVM starts to start, while-XMX represents the maximum amount of memory that the JVM can occupy when it is running, and if your application needs more memory than Xmx, the JVM throws out the memeory (out of memory) To stop the exception. Of course, the maximum value of xmx should not exceed 70% of the physical memory.
D:/back/blog>start_tomcat_debug.bat D:/back/blog>set java_opts=-xms256m D:/back/blog>rem Please modify the java_home environment variable to your JDK installation directory D:/back/blog>set Java_home=c:/program files/java/jdk1.5.0_09 D:/back/blog>rem Please modify the catalina_home environment variable to your Tomcat installation directory D:/back/blog>set catalina_home=c:/carl/it/tomcat_research/jakarta-tomcat-5.0.28 D:/back/blog>rem starts calling Catalina.bat file D:/back/blog>call C:/carl/it/tomcat_research/jakarta-tomcat-5.0.28/bin/catalina.bat Debug Using catalina_base:c:/carl/it/tomcat_research/jakarta-tomcat-5.0.28 Using catalina_home:c:/carl/it/tomcat_research/jakarta-tomcat-5.0.28 Using catalina_tmpdir:c:/carl/it/tomcat_research/jakarta-tomcat-5.0.28/temp Using Java_home:c:/program files/java/jdk1.5.0_09 Debug Invalid option:-xms256m
Usage: Jdb < options > < class > < parameters > ...
If you encounter a similar problem, you can reset the memory parameters for the JVM startup in the following way, adding the following line to the Startup.bat script:
Set java_opts=-xms256m-xmx512m
The above line indicates that Tomcat initial boot memory requires at least 256M, and that the maximum possible memory footprint is 512M. Interested readers can add this line of arguments to the Startup.bat and start Tomcat, and you'll see from Windows Task Manager that the memory you're using is soaring rapidly.
3.2 Tomcat Application Server configuration issues and one of the Web application issues deployed
The 3.2.1 Tomcat port conflict, as shown in the following window. This indicates that the default 8080 port is already occupied, so Tomcat cannot boot, and we can start by modifying the Tomcat profile Server.xml to redefine the port number, or stop the program that already uses port 8080. Sometimes we don't start Tomcat, and no other application uses 8080 ports, but Tomcat throws this error. This may be because the last time we shut down Tomcat, Tomcat was not really turned off. In this case, check to see if a Java.exe program is running from Windows Task Manager, and if found, forcibly kill Java.exe, and then restart the test.
The 3.2.2 Tomcat configuration file has an error, resulting in an exception. Sometimes when we modify the Server.xml file, we accidentally add or delete a </> tag, which may cause Tomcat to not start properly. The following window illustrates the problem.
A Web application deployed in 3.2.3 Tomcat has an exception. Tomcat starts normally, but a large stack of exceptions is found in the Tomcat startup window, such as if data source is not defined correctly, and the program throws an exception, among other things. The following example is a Balancer Web application with tomcat that generated an error when it started. The problem is due to our erroneous modification of the Balancer.xml file.
The 3.2.4 Web application's jar files are missing, such as the JDBC database connection file Class12.jar, and Mysql.jar are not copied to the WebApp web-inf/lib directory to produce an exception. It is particularly noteworthy that in previous versions of TOMCAT5, public jar packages were usually placed in the Common/lib subdirectory under the Tomcat installation directory, but in Tomcat6.0, the public directory was changed to Lib subdirectory.
3.3 Unknown Error 3.3.1 Sometimes Tomcat's startup window flashes and doesn't see what's wrong with the startup process. There are a number of reasons for this, and the most common solution is to use the Run command to open the Startup.bat file and find the following line:
Call "%executable%" Start%cmd_line_args%
and modify it to:
Call "%executable%" Run%cmd_line_args%
This way, when Tomcat starts without popping up a new window, we can take a leisurely look at Tomcat's startup errors and fix the problem, please refer to the explanation for the Run command above.
3.3.2 In addition, reading Tomcat's startup log file is also an important solution to our problem, and the default tomcat log is placed under the logs subdirectory of the Tomcat installation directory. For example, the following log shows that the Jspservletviewer Web application lacks the associated jar packages for map object, and thus the Java class com/esri/mo2/map/core/layout is not found.
2008-02-23 11:19:30 standardcontext[/jspservletviewer]exception Sending context initialized event to listener instance of Class Com.esri.svr.cmn.FileRewriterContextListener Java.lang.noclassdeffounderror:com/esri/mo2/map/core/layout At Com.esri.svr.cat.ServiceXMLHandler.startElement servicexmlhandler.java:47) At Org.apache.xerces.parsers.AbstractSAXParser.startElement (Unknown Source) At Org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement (Unknown Source) |