tomcat common errors and solutions Summary

tomcat web container in fact, but tomcat kernel is very rich, if you want to fully understand the need for a long time and more programming experience. Whether a beginner or an experienced web programmers, using Tomcat container when it will occur, including 404 operational startup errors, garbled and so on, this paper will share common errors encountered in the development process and simple solution for everyone .

First, when the tomcat startup error

问题1:The JAVA_HOME environment variable is not defined This environment variable is needed to run this program;

Solution: do not set the environment variable in the configuration file .bash_profile tomcat in JAVA_HOME, setting specific method: Add the following lines:

 JAVA_HOME = / home / tomcat / j2sdk1.4.2_08 (subject to specific values ​​for the actual installation path jdk)

 export JAVA_HOMECLASSPATH=/home/tomcat/j2sdk1.4.2_08/lib/tools.jar:/home/tomcat/j2sdk1.4.2_08/lib/dt.jar

 export CLASSPATH

问题2:Error occurred during initialization of VM Could not reserve enough space for object heap

Solution: In the bin directory of tomcat, tomcat memory parameters catalina.sh configuration file is too large, more than the total number of machines available memory caused changes to the appropriate value to modify the parameters as follows:JAVA_OPTS="-Xms50m -Xmx60m"

Question 3: Tomcat Start Times to a directory does not have permission, failed to start, or can not perform some jsp page

Solve: tomcat need to have the appropriate permissions to some directories and files tomcat user, all directory should have permission to perform (the browser) to read and write, jsp, class file should have at least read permissions, some files need write permission, the following is known needs list of file read and write permissions:

       All files under $ CATALINA_HOME / logs

       All files under $ CATALINA_HOME / work

       $CATALINA_HOME/publish/main/count.txt文件

       All .xml files under $ CATALINA_HOME / publish / chatroom / resource

All uploaded pictures will need write access to the directory.

Change the file directory permissions: Execute the following command to set all files and directories under the tomcat installation, you can ensure the implementation, but not very safe.

1. Set the parent directory tomcat / opt all users have read and write execute permissions:

 chmod 777 [tomcat's parent directory]

 

2. Set the owner of all files in the directory tomcat5.0.28 tomcat:

 chown -R tomcat [tomcat install directory]

3. Set the owner of all files and directories in all tomcat5.0.28 (tomcat) has read and write permissions to perform

 chmod 700 -R /opt/tomcat5.0.28

Question 4: After performing startup.sh file tells address has been used, resulting in tomcat can not start

Solution: probably before the first performance ./shutdown.sh file did not stop Java process has started closing tomcat, and this process is still in use tomcat listening port, or there is another tomcat is running, server.xml file tomcat listening port and the current conflict.

Use the following command to see whether the current system has the port is listening (8080 - webcache, 90 - www or http).

     1. List all the system is listening and bound port address netstat -l

     2. Find all processes currently in the system, the filter output conduit line containing the symbol string java

 ps -A | grep java 

 tty time proc

 1021 ? java 

     3. The end of a specified process:

 kill [process ID]

     4. Forced to kill a process:

 kill -9 [process ID]

     If it is determined conflict is not caused by other tomcat run or not to run java process running again startup.sh file to start tomcat

Two, Tomcat runtime errors and solutions

问题1: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network error IOException: Connection refused: connect)

问题2:Caused by: java.sql.SQLException: Network error IOException: Connection refused: connect

问题3:Caused by: java.NET.ConnectException: Connection refused: connect

Resolution: The database is not running tomcat case of problems, the database is opened opened on the line

Problem. 4: Java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit (IILjava / lang / String; Ljava / lang / String; [Ljava / lang / String; Ljava / lang / String;) Vat net.sf. cglib.core.ClassEmitter.begin_class (ClassEmitter.java:77) this problem is most common when first integration ssh will find this a problem, and sometimes delete the associated package or conflict. So the solution I usually:

Solution: The MyEclipse in hibernate package on ASM delete all, in the spring asm package copied into the restart on the Ok, sometimes you need to delete other files to look for it online;

There is a solution: Spring and Hibernate shared some of the jar files have version conflicts, delete the WEB-INF / lib / asm-2.2.3.jar and then restart Tomcat.

问题5:javax.servlet.jsp.JspException: Invalid argument looking up property usersVO.account of bean loginForm

Solution: General Tips This error indicates that there is no instance of VO in the form of, new look at the reset method on the Ok. Develop good coding practices can avoid this simple mistake.

Question 6: serious: Exception loading sessions from persistent storage

Solve: Tomcat installation directory \ work \ Catalina \ localhost \ { webAppName} \ SESSIONS.ser, delete this file

Third, because the 404 error page you requested is not available!

This is the response object http response status line 404 indicates the currently requested page is not available! 200 test passed. 500 internal server errors occur!

to sum up

That's all for this article, I hope the contents of this paper, we study or work can bring some help, if in doubt you can leave a message exchange.

Guess you like

Origin blog.csdn.net/qq_36838191/article/details/91490530