Summary of Tomcat + eclipse configuration problems

Source: Internet
Author: User

I have been plagued by configuration problems recently, and I am deeply aware of Java configuration problems. Here we will summarize the configuration problems and corresponding solutions.
1. Context settings
Error Description: context cannot be found.
Error Analysis: there are usually the following types:
1) eclipse will be on the server. XML or/CONF/Catalina/{Host}/$ {appname. XML} file, if eclipse is in $ {appname. dynamic settings are made in XML}, so it is best not to go to the server by yourself. manually added in XML.
2) do not add all applications in the current Tomcat webapps directory manually in server. xml; otherwise, errors may occur;
3) it is best to use the Tomcat plug-in of eclipse to directly use the server, which may cause inexplicable problems.

2. Web. xml Problems
Error Description: Web. XML is not found. You can put that stuff in the Web-INF directory...
Error analysis:
1) First: Eclipse a bug (http://shingwa.spaces.live.com/blog/cns! D90c8eaf1f36b3f9! 407. Entry ):
2006-4-9 10:17:23 org. Apache. Catalina. startup. contextconfig applicationwebconfig
Information: Missing Application Web. XML, Using defaults only standardengine [Catalina]. standardhost [localhost]. standardcontext []
It was actually a bug in Eclipse: Bugzilla bug 110954
Solution:
I'll fix this in the 1.0 Release. for now the error may be ignored. or, in the mean time, you can add a web. XML with the contents "<web-app> </Web-app>" to ". metadata /. plugins/org. eclipse. WST. server. core/tmp? /Webapps/root/WEB-INF "folder in your workspace. Replace "? "In" tmp? "With the appropriate number. This is enough to make the error go away.

The author's explanation is as follows:
To state the issue more clearly:
Until fixed, Tomcat 4.x and 5.x servers with "Run modules directly from the workspace..." Checked will always output a line like the following into the console log:

Info: Missing Application Web. XML, Using defaults only standardengine [Catalina]. standardhost [localhost]. standardcontext []
Note there is no text within the "[]" That follows standardcontext. this means that it applies to the default context, I. e. the one named root and thus whose context path is "". for this to apply to a web application added to the server, the context path for the Web application wowould appear within the "[]".
I wocould guess that your error message has "standardcontext []" and is not a symptom of your webapp breaking, even though it may be the only problem you see present in the console log. you may need check ". metadata /. plugins/org. eclipse. WST. server. core/tmp? /Logs "directory to see if there are other problems listed in log files there.
2) 2. Web. XML is manually created and case sensitive.
3) Third: Haha, or the context configuration is faulty... At this time, Tomcat will skip web. xml;
4) Question 4: servlet version:
Version issues between servlet2.4 and servlet2.2
In the second line of Web. XML, write servlet2.4 as follows:
<Web-app xmlns = "http://java.sun.com/xml/ns/j2ee" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" version = "2.4" xsi: schemalocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
Servlet2.2 is written as follows:
<! Doctype web-app public "-// Sun Microsystems, Inc. // DTD web application 2.2 //" http://java.sun.com/j2ee/dtds/web-app_2.2.dtd ">

5) Method 5: When spring is used, if listener is used, an error may be reported and the error message is ambiguous, as shown below:

  1. 2006-12-31 9:59:25 org. Apache. Catalina. Core. standardcontext start
  2. Severe: Error listenerstart

For servlet, everything is OK. The configuration is as follows:

<Servlet>
<Servlet-Name> springcontextservlet </servlet-Name>
<Servlet-class>
Org. springframework. Web. Context. contextloaderservlet
</Servlet-class>
<Load-on-startup> 1 </load-on-startup>
</Servlet>

So it is best to use servlet.

3. Other problems
Tomcat and JDK versions. It is best to use jdk1.5 in tomcat5.5. Otherwise, an inexplicable problem may occur.

4. Understand the eclipse workspace configuration file. Metadata, The. Project,. classpath,. tomcatplugin under the project, and so on, which is helpful for solving the problem.

Related Article

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.