1. Get the source code
Mode one: from the official website http://tomcat.apache.org/download-70.cgi direct download, the official website provides binary and source code two download method, to study the tomcat source code, choose source Codes method download
Mode two: Use SVN to get the source code, first install SVN, then create a new directory TOMCAT7, and then execute the following command in the directory
[Java]View Plaincopy
- SVN Co http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/tomcat_7_0_35/./
Tags directory has a different version of the Tomcat source code, the download version here is 7.0.35
2. Importing the source code into Eclipse Tomcat is created and managed using Ant. After you install Ant and then execute Ant ide-eclipse, the command executes successfully and is produced in the TOMCAT7 directory. Project and. Classpath two files, which became Eclipse Engineering. This allows you to import the Tomcat source into eclipse. Execute Ant ide-eclipse times wrong:
[Java]View Plaincopy
- BUILD FAILED build.xml:2361:the following error occurred while executing this line:
- BUILD FAILED build.xml:2449:compile FAILED; see the compiler error output for details.
To view the compiled error log:
[Java]View Plaincopy
- BUILD-TOMCAT-DBCP:
- [Copy] Copying files to E:\usr\share\java\tomcat7-deps\dbcp
- [Move] Moving files to E:\usr\share\java\tomcat7-deps\dbcp\src\java\org\apache\tomcat\dbcp
- [Javac] Compiling source files to E:\usr\share\java\tomcat7-deps\dbcp\classes
- [Javac] Warning: [Options] Bootstrap class path not set in conjunction with-source 1.6
- [Javac] E:\usr\share\java\tomcat7-deps\dbcp\src\java\org\apache\tomcat\dbcp\dbcp\BasicDataSource.java:53:error:bas
- Icdatasource is isn't abstract and does not override abstract method Getparentlogger () in Commondatasource
- [Javac] public class Basicdatasource implements DataSource {
- [Javac] ^
- [Javac] E:\usr\share\java\tomcat7-deps\dbcp\src\java\org\apache\tomcat\dbcp\dbcp\DelegatingStatement.java:46:error :
- Delegatingstatement is isn't abstract and does not override abstract method Iscloseoncompletion () in Statement
- [Javac] public class Delegatingstatement extends Abandonedtrace implements Statement {
- [Javac] ^
- [Javac] E:\usr\share\java\tomcat7-deps\dbcp\src\java\org\apache\tomcat\dbcp\dbcp\DelegatingPreparedStatement.java: $
- : Error:delegatingpreparedstatement is not abstract and does not override abstract method Iscloseoncompletion () I n Stat
- Ement
Depending on the log error, the dependent DBCP related jar version is incorrect. The native version of the JDK is 1.7, so a 1.6 jdk is installed on the machine, and the relevant environment variables are modified so that java_home points to the JDK 1.6 directory. Execute the ant ide-eclipse again and get the BUILD successful
Total Time:2 minutes seconds
Also note that the build log for BUILD-TOMCAT-DBCP is updated to:
[Java]View Plaincopy
- BUILD-TOMCAT-DBCP:
- [Copy] Copying files to E:\usr\share\java\tomcat7-deps\dbcp
- [Move] Moving files to E:\usr\share\java\tomcat7-deps\dbcp\src\java\org\apache\tomcat\dbcp
- [Javac] Compiling source files to E:\usr\share\java\tomcat7-deps\dbcp\classes
- [Javac] Note: Some input files use or overwrite outdated APIs.
- [Javac] Note: To learn more, recompile with-xlint:deprecation.
- [Javac] Note: Some input files use an unchecked or unsafe operation.
- [Javac] Note: To learn more, recompile with-xlint:unchecked.
- [Jar] Building Jar:e:\usr\share\java\tomcat7-deps\dbcp\tomcat-dbcp.jar
- [Jar] Building Jar:e:\usr\share\java\tomcat7-deps\dbcp\tomcat-dbcp-src.jar
Therefore, the problem can be summarized as follows: Tomcat source relies on JDK version 1.6 and below, using jdk1.7 will cause build failure. 3. Add the jar package in build path, solve the compilation problem after importing Eclipse, you will find that the project TOMCAT7 has a red exclamation point, because the dependent jar package is not added to the build path resulting in a compilation error. Refer to the third step in the blog http://jackycheng2007.iteye.com/blog/1477845. Another problem encountered, the Org.apache.naming.factory.webservices package of two classes serviceproxy,servicereffactory still wrong, unrecognized
[Java]View Plaincopy
- import javax.xml.rpc.service;
- IMPORT JAVAX.XML.RPC.SERVICEEXCEPTION;  
- import javax.wsdl.definition;
- import javax.wsdl.port;
-
- import javax.wsdl.extensions.soap.soapaddress;
- IMPORT JAVAX.WSDL.FACTORY.WSDLFACTORY;  
- import javax.wsdl.xml.wsdlreader;
These classes. The machine is still missing jar package, Baidu found the lack of a Web service development Kit Axis-bin-1_4.zip. After downloading, add to build path to resolve. Aside from: Ant does not have maven handy, maven can manage dependent jars and automatically downloads dependencies from the Maven repository without having to manually download the jar and add the build path
4. Run the fourth step in the reference blog http://jackycheng2007.iteye.com/blog/1477845
Tomcat Source Import Eclipse step