Tomcat source code compilation and environment setup

Source: Internet
Author: User

Tomcat source code compilation and environment setup

The compilation of tomcat source code and environment setup have also been delayed for some time. Today, we are still doing it with a bit of strength, but we still have some gains.
Tomcat source code compilation is still the first choice ant. As the top-level project ant of apache, you can refer to the following link to download and download a Binary Runtime package.
Http://ant.apache.org/bindownload.cgi

Then you need to configure it in path.

Simple Verification

C: \ Users \ jeanron> ant-version

Apache Ant (TM) version 1.9.5 compiled on May 31 2015

Download the tomcat source code, which can be selected in tomcat.apache.org. to be compatible with the jdk version, I chose tomcat7.
After downloading and decompressing the package, you must modify the following files in the directory.

Rename build. properties. default to build. properties.

Modify base. path in build. properties.
The default value is:

Base. path =/usr/share/java

Because the local environment is windows, modify it to the following style.

Base. path = D:/tomcat7/output

According to official suggestions, it is best to configure the following proxy configuration in build. properties. When I compare it locally, basically there is no response on the interface without configuration, and the configuration speed is still very fast.

Proxy. use = on

Proxy. host = proxy. domain

Proxy. port = 8080

Proxy. user = username

Proxy. password = password

Of course, the jdk version is also required. I use 1.6 locally.
Then start build.

D: \ tomcat7> ant

Buildfile: D: \ tomcat7 \ build. xml

Build-prepare:

[Mkdir] Created dir: D: \ tomcat7 \ output \ classes

[Mkdir] Created dir: D: \ tomcat7 \ output \ build

[Mkdir] Created dir: D: \ tomcat7 \ output \ build \ bin

[Mkdir] Created dir: D: \ tomcat7 \ output \ build \ conf

[Mkdir] Created dir: D: \ tomcat7 \ output \ build \ lib

[Mkdir] Created dir: D: \ tomcat7 \ output \ build \ logs

[Mkdir] Created dir: D: \ tomcat7 \ output \ build \ temp

[Mkdir] Created dir: D: \ tomcat7 \ output \ build \ webapps

Download-compile:

Testexist:

[Echo] Testing for D:/tomcat7/output/tomcat-native-1.1.33/tomcat-native.ta

R.gz

Downloadfile-2:

Proxyflags:

Setproxy:

[Echo] Using proxy. domain: 8080 to download http://www.apache.org/dist/tomca

T/tomcat-connectors/native/1.1.33/source/tomcat-native-1.1.33-src.tar.gz

Trydownload. check:

Trydownload:

[Get] Getting: http://www.apache.org/dist/tomcat/tomcat-connectors/native/

1.1.33/source/tomcat-native-1.1.33-src.tar.gz

[Get] To: D: \ tomcat7 \ output \ download-2067852301.tmp

Of course, the build process is not smooth sailing, for example, network problems, direct timeout and exit.

D: \ tomcat7 \ build. xml: 2927: java.net. ConnectException: Connection timed out: conn

Ect

At java.net. DualStackPlainSocketImpl. connect0 (Native Method)

At java.net. DualStackPlainSocketImpl. socketConnect (DualStackPlainSocketI

Mpl. java: 79)

At java.net. AbstractPlainSocketImpl. doConnect (AbstractPlainSocketImpl. ja

Va: 339)

At java.net. AbstractPlainSocketImpl. connectToAddress (AbstractPlainSocket

Impl. java: 200)

Using jdk 1.7 in another environment has some problems during build.

....

[Javac] ^

[Javac] D: \ tomcat7 \ output \ tomcat7-deps \ dbcp \ src \ java \ org \ apache \ tomcat \ dbcp \

Dbcp \ datasources \ PerUserPoolDataSource. java: 60: Error: PerUserPoolDataSource is not

And does not overwrite the abstract method getParentLogger () in CommonDataSource ()

[Javac] public class PerUserPoolDataSource

[Javac] ^

[Javac] D: \ tomcat7 \ output \ tomcat7-deps \ dbcp \ src \ java \ org \ apache \ tomcat \ dbcp \

Dbcp \ datasources \ SharedPoolDataSource. java: 52: Error: SharedPoolDataSource is not extracted

And does not overwrite the abstract method getParentLogger () in CommonDataSource ()

[Javac] public class SharedPoolDataSource

[Javac] ^

[Javac] Note: some input files use or overwrite outdated APIs.

[Javac] Note: For details, use-Xlint: deprecation to recompile.

[Javac] Note: some input files use uninspected or insecure operations.

[Javac] Note: For details, use-Xlint: unchecked to recompile.

[Javac] 15 errors

[Javac] 1 warning

BUILD FAILED

D: \ tomcat7 \ build. xml: 2686: The following error occurred while executing this lin

E:

D: \ tomcat7 \ build. xml: 2790: Compile failed; see the compiler error output for det

Ails.

Total time: 1 minute 21 seconds

The last change to 1.6 is OK.

Build:

[Javac] Compiling 31 source files to C: \ tomcat7 \ output \ jdbc-pool \ classes

[Jar] Building jar: C: \ tomcat7 \ output \ jdbc-pool \ tomcat-jdbc.jar

[Copy] Copying 1 file to C: \ tomcat7 \ output \ build \ lib

BUILD SUCCESSFUL

Total time: 2 minutes 1 second

The first section of source code compilation is introduced in eclipse,
You can directly create a java project and select the tomcat source code path. The imported source code is as follows:

Of course, there are dependent packages.

There are several dependent packages, such as ant...
However, it can still be started smoothly through eclipse.

INFO: Deploying web application directory C: \ tomcat7 \ webapps \ ROOT

Jun 29,201 5 11:47:20 org. apache. catalina. startup. TldConfig execute

INFO: At least one JAR was scanned for TLDs yet contained no TLDs. enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

Jun 29,201 5 11:47:20 org. apache. catalina. startup. HostConfig deployDirectory

INFO: Deployment of web application directory C: \ tomcat7 \ webapps \ ROOT has finished in 27 MS

Jun 29,201 5 11:47:20 org. apache. coyote. AbstractProtocol start

INFO: Starting ProtocolHandler ["http-bio-8080"]

Jun 29,201 5 11:47:20 org. apache. coyote. AbstractProtocol start

INFO: Starting ProtocolHandler ["ajp-bio-8009"]

Jun 29,201 5 11:47:20 org. apache. catalina. startup. Catalina start

INFO: Server startup in 626 MS

-------------------------------------- Split line --------------------------------------

Deployment of Nginx + MySQL + PHP in CentOS 6.2

Build a WEB server using Nginx

Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5

Performance Tuning for Nginx in CentOS 6.3

Configure Nginx to load the ngx_pagespeed module in CentOS 6.3

Install and configure Nginx + Pcre + php-fpm in CentOS 6.4

Nginx installation and configuration instructions

Nginx introduction and source code compilation and Installation

Nginx log filtering using ngx_log_if does not record specific logs

-------------------------------------- Split line --------------------------------------

Nginx details: click here
Nginx: click here

This article permanently updates the link address:

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.