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:
- 2006-12-31 9:59:25 org. Apache. Catalina. Core. standardcontext start
- 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.