Common bugs and solutions for Tomcat summary _tomcat

Source: Internet
Author: User
Tags chmod parent directory sessions

First, Tomcat startup error

Question 1: The JAVA_HOME environment variable is isn't defined this environment variable be needed to run this program;

Workaround: do not set the environment variable Java_home in Tomcat's configuration file. Bash_profile by adding the following lines:

 java_home=/home/tomcat/j2sdk1.4.2_08 (the actual JDK installation path is the exact value)

 export java_homeclasspath=/home/tomcat/j2sdk1.4.2_ 08/lib/tools.jar:/home/tomcat/j2sdk1.4.2_08/lib/dt.jar

 Export CLASSPATH

Question 2: Error occurred during initialization of VM could not reserve enough spaces for object heap

Workaround: in Tomcat's Bin directory, the catalina.sh file's tomcat memory parameter configuration is too large, more than the total amount of available memory in the machine, modified to the appropriate value, the modified parameters are:JAVA_OPTS="-Xms50m -Xmx60m"

Issue 3:tomcat startup times a directory does not have permissions, startup fails, or some JSP pages cannot be executed

Workaround:Tomcat requires that Tomcat users have the appropriate permissions for directories and files, that all directories should have read/write permission, jsp,class files should have the least reading permissions, some files need write permissions, The following is a list of known files that require read and write permissions:

$CATALINA All Files under _home/logs

$CATALINA All Files under _home/work

$CATALINA _home/publish/main/count.txt File

$CATALINA all the. xml files under _home/publish/chatroom/resource

All uploaded image directories require write permission.

Ways to change file directory permissions: Execute the following command, setting all files and directories under Tomcat installation, but not very secure.

1. Set up Tomcat ancestor directory/opt all users have read and write execution rights:

 chmod 777 [Tomcat's parent directory]

2. Set the owner of all files under the tomcat5.0.28 directory as Tomcat:

 Chown-r Tomcat [Tomcat installation directory]

3. Set all files and directories under All tomcat5.0.28 (Tomcat) has read and write execution rights

 chmod 700-r/opt/tomcat5.0.28

Issue 4: when the startup.sh file is executed, the address has been used to prevent Tomcat from starting

Resolve: may be previous execution./ The shutdown.sh file shuts down Tomcat without stopping the already-started Java process, which still listens to the port that Tomcat uses, or another tomcat is running, server.xml the listener port in the file and the current Tomcat conflict.

Use the following command to see if the current system has a listening port (8080--webcache, 90--www, or HTTP).

1. List the ports and bindings addresses that all systems are listening to netstat-l

2. Find all processes in the current system, pipe symbol filter output shows the line containing Java strings

 Ps-a |grep java 

 tty time proc

 

3. To end a specified process:

 Kill [Process number]

4. Force the killing of a process:

 kill-9 [Process number]

If you determine that a conflict is not caused by another tomcat run or that no Java process is running, you can run the startup.sh file again to start Tomcat

Second, Tomcat run-time errors and Solutions

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

Workaround: run the Tomcat problem while the database is not open, and 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 (classemitter.java:77) The problem is the most common, The first time you integrate SSH, you will find this problem, sometimes delete the related package or will conflict. So the solution I'm generally:

Solution: Remove all the ASM-related packages from the MyEclipse in the Hibernate, copy the ASM package in spring and restart the OK, sometimes need to delete other files, to find it online;

There is also a workaround: Some jar files shared by Spring and Hibernate have version conflicts, delete Web-inf/lib/asm-2.2.3.jar, and then restart Tomcat.

Issue 5:javax.servlet.jsp.JspException:Invalid argument looking up property Usersvo.account of Bean LoginForm

Workaround: General Hints This error indicates that the form in Vo is not instantiated, and new in the Reset method is OK. Develop good coding habits to avoid this simple error.

Question 6: serious: Exception loading sessions from persistent storage

Resolve:Tomcat install directory \work\catalina\localhost\{webappname}\sessions.ser, delete this file

Third, there are 404 errors because the page you requested is not available!

This is the status line 404 in the HTTP response of the response object to indicate that the currently requested page is not available! 200 indicates that the test passed. 500 indicates that there are errors inside the server!

Summarize

The above is the entire content of this article, I hope the content of this article for everyone to learn or work can bring some help, if you have questions you can message exchange.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.