Summary of common tomcat errors and solutions

  • 2020-05-27 07:40:59
  • OfStack

1. Error starting tomcat

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

Solution: the environment variable JAVA_HOME is not set in the bash_profile configuration file.

 JAVA_HOME=/home/tomcat/j2sdk1.4.2_08 The specific value should be realistic jdk Installation path shall prevail) 

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


Question 2: Error occurred during initialization VM Could not enough space for object heap

Solution: in the bin directory of tomcat, the tomcat memory parameter configuration of file is too large, which exceeds the total amount of available memory of the machine. It can be modified to the appropriate value. The modified parameter is: JAVA_OPTS="-Xms50m -Xmx60m"

Problem 3: tomcat startup times does not have permissions for a directory, startup fails, or some jsp pages cannot be executed

Solution: tomcat requires tomcat user to have 1 access to some directories and files, all directories should have access to read and write execution (browse),jsp,class files should have at least read access, 1 access to write files, the following is a list of known access to read and write files:

$CATALINA_HOME/logs for all files

$CATALINA_HOME/work for all files

$CATALINA_HOME publish/main/count txt file

$CATALINA_HOME/publish chatroom/all resource. xml file

All uploaded image directories require write permission.

Change the file directory permissions: execute the following command to set all the files and directories under the tomcat installation, which can be guaranteed to execute, but it is not very secure.

1. Set tomcat superior directory /opt to allow all users to read and write:

 chmod 777 [tomcat Parent directory ]

2. Set tomcat5.0.28 to tomcat:

 chown -R tomcat [tomcat The installation directory ]

3. Set the owner (tomcat) of all files and directories under tomcat5.0.28 to have read and write execution rights

 chmod 700 -R /opt/tomcat5.0.28

Problem 4: after executing the file, the address is told that it has been used, so tomcat cannot be started

Resolution: may be the last time the file was executed./ closes tomcat without stopping the already started Java process, which is still listening on the port used by tomcat, or another tomcat is running, and the listening port in the server.xml file conflicts with the current tomcat.

Use the following command to see if the current system has any ports being listened to (8080--webcache, 90--www or http).

1. List all ports and binding addresses netstat-l that the system is listening to

2. Find out all the processes in the current system. The pipe symbol filter output shows the lines containing the java string

 ps -A |grep java 

 tty time proc

 1021 ? java 

3. Termination of a specified process:

 kill [ Process of no. ]

4. Force kill 1 process:

 kill -9 [ Process of no. ] file can be run again to launch tomcat if it is determined that there is no conflict caused by another tomcat run or no java process run

2. Tomcat runtime error and resolution

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

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

Question 3: Caused by: java.NET.ConnectException: Connection refused: connect

Solution: when running tomcat without database open, just open the database

Question 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 (77). ClassEmitter java: this question is the most common, when first integrated ssh will find this problem, delete the related package or sometimes conflict. So I like 1 solution is:

Solution: delete all the ASM packages in hibernate, copy asm packages in spring, and restart Ok. Sometimes you need to delete other files, just look for them on the Internet.

Another solution: some jar files Shared by Spring and Hibernate have version conflict, delete WEB-INF /lib/ asm-2.2.3.jar and restart Tomcat.

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

Solution: 1 this error indicates that form in VO is not instantiated. new1 in reset is Ok. This simple mistake can be avoided by developing good coding habits.

Problem 6: serious: Exception loading sessions from persistent storage

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

3. A 404 error occurred because the page you requested was not available!

This is the status line 404 in the http response of the response object to indicate that the page being requested is not available! 200 means the test passed. 500 means the server internal error!


The above is the entire content of this article, I hope the content of this article can bring 1 definite help to everyone's study or work, if you have any questions, you can leave a message to communicate.

Related articles: