Effective Solution for context [] startup failed due to previous errors

Source: Internet
Author: User

During the construction of the struts2 + spring + Hibernate framework in the past two days, I encountered a problem. I checked the problem on Baidu and Google for two days, so that the crash was approaching. Finally, the problem is solved. There are many reasons for this problem, which are summarized as follows for sharing:

 

After the framework is set up, the following information appears when you start the server:

Log4j: warn no appenders cocould be found for logger (Org. Apache. commons. digester. digester ).

Log4j: Warn please initialize the log4j system properly.

2009-11-6 21:39:17 org. Apache. Catalina. Core. standardcontext start

Severe: Error listenerstart

2009-11-6 21:39:17 org. Apache. Catalina. Core. standardcontext start

Severe: context startup failed due to previous errors

2009-11-6 21:39:17 org. Apache. Catalina. Core. standardhostdeployer install

Information: Installing web application at context path/tomcat-docs from URL File: D:/Server/tomcat 5.0/webapps/tomcat-docs

2009-11-6 21:39:17 org. Apache. Catalina. Core. standardhostdeployer install

Information: Installing web application at context path/WebDAV from URL File: D:/Server/tomcat 5.0/webapps/WebDAV

....

 

Possible errors:

1. Web. xml file: Web application deployment descriptor, which contains the deployed XML file or class. If these files cannot be found, a startup failed due to previous errors error occurs.

2. If spring is applied, this error will also be reported if the classes and XML files defined in the configuration file applicationcontext. xml cannot be found.

3. Any errors in the web. XML, Struts. XML, and applicationcontext. xml files may cause this problem, not just the file errors.

4. If ibatis is used, this error is returned if the XML file defined in sqlmapconfig. xml cannot be found. (Hibernate configuration uses the spring configuration file when integrating spring)

5. For JDK version problems, it is best to use JDK or a later version.

6. Compatibility Between eclipse and tomcat versions

7. This error may also occur when the jar package imported to lib conflicts during framework integration.

8. This error can also be generated if the jar package is missing or the version of the jar package is used.

9. Other reasons

 

Solution:

The problem above may have been caused by an internal error on the Web server, and the log information in the IDE is small, so it is difficult to solve the problem.

This problem often leads to an HTTP 404 error where the page Jump fails to find the file .....

You can add a log file to Tomcat to make the log information prompt more accurate, that is, set the log output level.

1. Create the log4j. properties file in the classes folder under the common folder of Tomcat home in the tomcat installation path, that is

... Apache Software Foundation/tomcat 5.5/common/classes

Log4j. properties is configured as follows (the configuration is reprinted ):

Log4j. rootlogger = info, console, R

Log4j. appender. Console = org. Apache. log4j. leleappender

Log4j. appender. Console. layout = org. Apache. log4j. patternlayout

# Log4j. appender. Console. layout. conversionpattern = % d [% T] %-5 p % C-% m % N

Log4j. appender. Console. layout. conversionpattern = % d {YY-mm-dd hh: mm: SS} % 5 P % c {1}: % L-% m % N

 

Log4j. appender. r = org. Apache. log4j. dailyrollingfileappender

Log4j. appender. R. File =$ {Catalina. Home}/logs/tomcat. Log

Log4j. appender. R. layout = org. Apache. log4j. patternlayout

Log4j. appender. R. layout. conversionpattern = % d {YYYY. Mm. dd hh: mm: SS} % 5 P % c {1} (% L ):? % M % N

 

Log4j.logger.org. Apache = info, R

Log4j.logger.org. Apache. Catalina. Core. containerbase. [Catalina]. [localhost] = debug, R

Log4j.logger.org. Apache. Catalina. Core = info, R

Log4j.logger.org. Apache. Catalina. Session = info, R

 

2. Copy the log4j-1.2.15.jar and commons-logging.jar package... Apache Software Foundation/tomcat 5.5/common/lib.

 

Complete the preceding two steps. When the server is started, it will be in the tomcat installation path .. Apache Software Foundation/tomcat 5.5/logs

Generate the tomcat. Log File to record the log information.

Note: Many logs are recorded in the tomcat. log file. If it is too large, the disk space may be insufficient. We recommend that you clear the logs regularly.

The above log file information can be used to locate the specific root cause of the problem. You can solve the problem by carefully checking the problem.

After I build the framework. when the welcome page configured in the XML file is displayed, the Error 404 is reported. Two errors are found through the above method. Although it took two days, the solution is finally solved.

Search for joy in the process and program freely in joy !!!!

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.