TOMCAT + APACHE + JDK + MYSQL

Jdk1.6 + Tomcat6 + Apache2 + MySql5 installed (Windows version)


Keywords: Jdk1.6 Tomcat6 Apache2 Mysql5 jk_mod.so

Jdk1.6 + Tomcat6 + Apache2 + MySql5 installed (Windows version)

Software download:
1, j2se jdk1.6
http://java.sun.com/javase/downloads/index.jsp

2, Tomcat 6
http://archive.apache.org/dist/tomcat/tomcat-6/

3, Apache 2.2.4
http://archive.apache.org/dist/httpd/

4, MySql5.0.27
http://dev.mysql.com/downloads/mysql/

5, mysql-connector-java-5.0.5
http://dev.mysql.com/downloads/connector/j/

6, mod_jk-apache-2.2.4.so
http://tomcat.apache.org/download-connectors.cgi

You can download the latest or most stable version, if the deployment of the online environment can be a stable version,
However, if at studying and debugging, you can try the new version, because things are moving forward.

General procedures or services page, if not very large, Web server with Tomcat to do it, there is no need to integrate apache + tomcat.
Of course, if there is a genuine need, such as to static files (html, picture, etc.) and Java files from apache and tomcat to resolve,
Or for study, testing, and also run php and so on, the integration can be considered under apache + tomcat.

If only the required JSP web server, as long as the installation of JDK + Tomcat can, and the installation process is very simple.

http://Jiarry.blogchina.com

================================================== ==============================

<br /> The installation process to install this download document Introduction:
http://jarryli.googlepages.com/Jdk1.6Tomcat6Apache2MySql5Install.txt

Step 1 JDK installation
-------------------------------------------------- --------------------------------
1.1-click jdk-6u1-windows-i586-p.exe file to install Jdk, select the directory (if E: \ jdk1.6), return all the way, the installation is complete 1.2 Add JAVA environment variable (My Computer Right -> property -- > Advanced -> Environment Variables -> System Variables)
Set CLASSPATH variable value.;% JAVA_HOME% / bin;% JAVA_HOME% / jre / bin;% JAVA_HOME% / lib;% JAVA_HOME% / lib / tools.jar;% JAVA_HOME% / lib / dt.jar
Set JAVA_HOME variable value E: / jdk1.6
PATH variable value settings.;% JAVA_HOME%;% JAVA_HOME% / bin;
1.3 in the DOS command line under test the success of Java installed, knock-java-version can view the version of c: \> java-version
java version "1.6.0_01"
Java (TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot (TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
1.4 Test HelloWorld, create a new document HelloWorld.java, which reads as follows public class HelloWorld (
public static void main (String arg []) (
System.out.println ( "Hello World! This is Java testing procedures to show that you have successfully installed Java - Jarry!");
)
)
Enter at the command line javac HelloWorld.java, compile and then run java HelloWorld, will be able to see the normal output.
Errors in general are case-sensitive, such as environment variables or have questions, double-check there will be no problem.

Step 2 Tomcat installation
-------------------------------------------------- --------------------------------
2.1 click apache-tomcat-6.0.10.exe file to install Tomcat, select the directory (if E: \ Tomcat6) added 2.2 After the installation is complete TOMCAT environment variable (My Computer Right -> Properties -> Advanced -> Environment Variables -> system variables)
Set TOMCAT_HOME variable value E: / Tomcat6
2.3 from the Programs menu or Start Services in Tomcat, then you enter in the browser http://localhost:8080/ Can see the Tomcat welcome page.
Under normal circumstances will be successful, if the startup fails, please check jakarta_service_ date. Log Log, which can generally solve the problem.

Such as a similar error:
[947 prunsrv.c] [error] Failed creating java
System tray look windows/system32 / under is missing msvcr71.dll file, if missing, required a copy from another machine over.

Open a browser to enter the http://localhost:8080/ When the icon to see Tomcat kitten, so that the installation is successful.

At this point, JSP server on completed structures for the study and test no problem, if you want a more advanced configuration, you can continue to look to the following.

Tomcat 6 and Tomcat 5 or not the same as previous versions is that the home did not show the specific version of Cat Long have changed .
No admin management pages of the, admin at Tomcat 5.5 by default do not have to, but can download the admin pack.
Tomcat 6.0 and did not see admin package, but this does not matter, under normal circumstances do not need admin package.

Tomcat 6.0 does not open the default servlet, prohibit directory browsing. This is required to conf / Under web.xml configuration file.
Modify listings for that is true directory browsing,

<param-name> listings </ param-name>
<param-value> true </ param-value>
<! - False disable listings ->
<! - <param-value> False </ param-value> ->

Servlet open direct access to functions, these two notes to open.

<servlet>
<servlet-name> invoker </ servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</ servlet-class>
<init-param>
<param-name> debug </ param-name>
<param-value> 0 </ param-value>
</ init-param>
<load-on-startup> 2 </ load-on-startup>
</ servlet>

<servlet-mapping>
<servlet-name> invoker </ servlet-name>
<url-pattern> / servlet / * </ url-pattern>
</ servlet-mapping>

2.4 to deploy a new project testApp, go conf / configure server.xml

<Context path = "/ testApp" reloadable = "true" docBase = "E: / testApp"
workDir = "E: \ Tomcat6 \ webapps \ testApp \ work" />

You are docBase procedures directory, assuming that on the E root TestApp on this new project set up, and restart Tomcat, visit http://127.0.0.1:8080/testApp You can see the directory of the

2.5 mysql-java connector download mysql java connector, can select required 3.x or 5.x, before our General 3.x, may now try 5.x
http://dev.mysql.com/downloads/connector/j/
Will have to download from mysql-connector-java-5.0.5-bin.jar file into Tomcat6 \ commom \ lib directory (Tomcat 6.0 directory structure modified, the original common / lib all jar package into lib directory is now under ,
So you need to place your original in the common / lib directory to the jar to the lib directory. )

2.6 JDBC database connection pool, assumptions have installed mysql (no installation on the first installation), and set up a database test, modify conf / under server.xml

<Context path = "/ testApp" docBase = "E: / testApp"
debug = "5" reloadable = "true" crossContext = "true" workDir = "">
<Resource name = "jdbc / testApp"
auth = "Container"
type = "javax.sql.DataSource"
maxActive = "100" maxIdle = "30" maxWait = "10000"
username = "root" password = ""
driverClassName = "com.mysql.jdbc.Driver"
url = "jdbc: mysql: / / localhost: 3306/test? autoReconnect = true & useUnicode = true & characterEncoding = utf-8" />
</ Context>

Corresponding input port and user name password, but also pay attention to & to write & characterEncoding and Chinese garbled useUnicode problem to solve, real version of configuration will be slightly different.

In addition, the project folder / webapps / testApp / WEB-INF / under the new web.xml file, add the following content
<web-app xmlns = " http://java.sun.com/xml/ns/j2ee "
xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance "
xsi: schemaLocation = " http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd "
version = "2.4">
<description> MySQL Test App </ description>
<resource-ref>
<description> DB Connection </ description>
<res-ref-name> jdbc / testApp </ res-ref-name>
<res-type> javax.sql.DataSource </ res-type>
<res-auth> Container </ res-auth>
</ resource-ref>
</ web-app>

2.7 set up JDBCtest.jsp, can be to detect the success of JDBC connections
<% @ Page
language = "java"
contentType = "text / html; charset = GB2312"
pageEncoding = "GB2312"
%>
<% @ Page import = "java.sql .*"%>
<% @ Page import = "javax.sql .*"%>
<% @ Page import = "javax.naming .*"%>
Database connection pool test results:
<%
out.println ( "JDBC driver checks <br>");
try (
Class.forName ( "com.mysql.jdbc.Driver");
out.println ( "check successful! <br>");
) Catch (ClassNotFoundException cnfe) (
out.println ( "JDBC driver failed to create! <br>");
cnfe.printStackTrace ();
)

out.println ( "<br> environment namespace check <br>");
try (
&bsp; javax.naming.Context ctx = new javax.naming.InitialContext ();
javax.naming.Context envContext =
(javax.naming.Context) ctx.lookup ( "java: / comp / env");
out.println ( "check successful! <br>");

out.println ( "<br> search data sources <br>");

/ / Org.apache.commons.dbcp.BasicDataSource ds =
/ / (Org.apache.commons.dbcp.BasicDataSource) envContext.lookup ( "jdbc / testApp");
DataSource ds = (DataSource) ctx.lookup ( "java: comp / env / jdbc / testApp");
out.println ( "search success! <br>");
/ / An earlier version can be used to receive BasicDataSource than the DataSource interface to obtain more specific information for error search
out.println ( "<br> inspection database <br>");
Connection conn = ds.getConnection ();
DatabaseMetaData metaData = conn.getMetaData ();
ResultSet rs = metaData.getCatalogs ();
while (rs.next ())
out.println (rs.getString (1) + "<br>");
rs.close ();
) Catch (javax.naming.NamingException e) (
out.println ( "environment variable to create the failure of context! <br>");
e.printStackTrace ();
) Catch (SQLException e) (
out.println ( "failed to implement database operations! <br>");
e.printStackTrace ();
)
%>

2.7 servlet mapping, if you do not want to through the / servlet / com.file.web.HelloWorld to access your program, add the mapping is a good way,
Modify the project folder WEB-INFO/web.xml files, add
<servlet>
<servlet-name> HelloWorld </ servlet-name>
<servlet-class> com.file.web.HelloWorld </ servlet-class>
</ servlet>
<servlet-mapping>
<servlet-name> HelloWorld </ servlet-name>
<url-pattern> / hello </ url-pattern>
</ servlet-mapping>

This can / hello to access the servlet process.

Setp 3 Apache installation
-------------------------------------------------- --------------------------------

Enter all the way to install 3.1 Apache can knock http://127.0.0.1 Will be able to see the welcome interface.
Welcome to interface with different 2.0.x or 1.x, you will see It works!, And no longer are, you can see this page, you have successfully installed the like.

3.2 connect apache and tomcat, through apache to resolve static files, tomcat analytic really good java.
If you intend to do only with Tomcat server, then there would be no need to install apache and Tomcat as the server is also in fact very good.
Of course, integration does not apahce + tomcat Troublesome, mainly mod_jk.so download files, and add two configuration files.

3.2.1 download mod_jk.so ( http://mirrors.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-connectors/ )
See the article: http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
http://tomcat.apache.org/connectors-doc/reference/workers.html
Jk are here used instead of jk2, download get mod_jk-apache-2.2.4.so documents can apache to select the appropriate version.
Will download a file copy to Apache's modules directory
3.2.2 New workers.properties, easy to manage on apache2/conf under, add the following content
JkAutoAlias E: / Tomcat6/webapps # tomcat absolute path webapps directory JkMount / *. jsp ajp13
JkMount / * / servlet / ajp13

3.2.3 New mod_jk.conf documents on apache2/conf directory, add the following content # Load mod_jk module
LoadModule jk_module modules/mod_jk-apache-2.2.4.so

# Where to find workers.properties
JkWorkersFile conf / workers.properties
# Workers.properties just new documents
# Where to put jk logs
JkLogFile logs / mod_jk.log

# Set the jk log level [debug / error / info]
JkLogLevel info

# Select the log format
JkLogStampFormat "[% a% b% d% H:% M:% S% Y]"

# JkOptions indicate to send SSL KEY SIZE,
JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories

# JkRequestLogFormat set the request format
JkRequestLogFormat "% w% V% T"

# Send servlet for context / examples to worker named ajp13
JkMount / servlet / * ajp13
# Send JSPs for context / examples to worker named ajp13
JkMount / *. jsp ajp13
JkMount / *. do ajp13

# Increase TestApp directory, put all the files to directory of all to deal with tomcat,
# JkMount / testApp / * ajp13
# Can also be required to set, for example, only put testApp / *. jsp to tomcat treatment JkMount / testApp / *. jsp ajp13

3.2.4 modify conf / httpd.conf file, put into mod_jk.conf document include loading, add the following
Include conf / mod_jk.conf
# jarry add for contact to tomcat

Add TestApp give apache directory
# Add TestApp
Alias / testApp "e: / testApp"
<Directory "e:/testApp">
Options Indexes MultiViews
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Order allow, deny
Allow from all
</ Directory>

Restart apache,
By http://172.18.101.17:8080/testApp/ Or http://172.18.101.17/testApp/
Tomcat can visit the project to illustrate the successful integration.
Can also set up a jsp file to test, if it is not directly resolve port 8080, that indicate the success of integration.
See if there is the issue of attention, apache / logs / under the log file, carefully controlled, in general you will be able to solve.

Setp 4 MySql installation
-------------------------------------------------- --------------------------------

MySql and Apache, as you can enter all the way.
MySql5.x with little difference between 4.x installed, 5.x will be prompted to configure Mysql some property, such as language La. . According to required settings.
Start through the mysql / bin, type mysql-uroot-p or from the menu bar to enter the MySQL Command Line Client to the command line.
4.1 from the Programs menu to find mysql command-line or in the mysql / bin directory, the implementation of mysql-uroot-p password to enter the mysql
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 42 to server version: 5.0.27-community-nt

Type 'help;' or '\ h' for help. Type '\ c' to clear the buffer.

mysql>

4.2 knockin \ s can view information MySql version mysql> \ s
--------------
E: \ MySQL5 \ bin \ mysql.exe Ver 14.12 Distrib 5.0.27, for Win32 (ia32)

Connection id: 42
Current database:
Current user: root @ localhost
SSL: Not in use
Using delimiter:;
Server version: 5.0.27-community-nt
Protocol version: 10
Connection: localhost via TCP / IP
Server characterset: gbk
Db characterset: gbk
Client characterset: gbk
Conn. Characterset: gbk
TCP port: 3306
Uptime: 2 days 4 hours 52 min 9 sec

Threads: 2 Questions: 382 Slow queries: 0 Opens: 28 Flush tables: 1 Open ta
bles: 0 Queries per second avg: 0.002

================================================== ==============================

Overall, the installation of the new with the old version is almost, but compatibility is not a very good time.
But for the development and study, using the new version is still pretty good, can learn new ways and things, the new version easier to integrate and if the deployment of external services, or the use of sophisticated version of the classic or the bar. :)
To watch the installation process many apache official website of the documents, http://tomcat.apache.org/tomcat-6.0-doc/
Through the document can learn more about the installation steps, and wrong, or inspection, a different configuration, such as version, there will be a little bit different, This is the official documents look very important.

References:
Installation Jdk + Tomcat + Apache + PHP + MySql (Windows) Details http://jiarry.bokee.com/2375369.html
Installation Jdk + Tomcat + Apache + PHP + MySql (Linux) Details http://jiarry.bokee.com/2425368.html

Download files:
http://jarryli.googlepages.com/Jdk1.6Tomcat6Apache2MySql5Install.txt




To add some prior record:

Configure apache and php with tomcat, so that apache support php and jsp, servlet, such as apache strong web server, specifically to run a powerful web, so file on E: \ Apache2 \ htdocs under the can. Of course, tomcat can still be used when alone, but used to develop or test, or good, if as a website to publish or use apache in this way good. This next, apache only to exert the effects. Ha ha.

And correctly installed under apache good jdk, tomcat, the beginning of the integration apahce + tomcat
Modify apache / conf / under the httpd.conf file to add the following to support the jsp and php

1, mod_jk_2.0.46.dll copies of documents to the E: \ Apache2 \ modules directory
2, modify http.conf file, add the following jk module content
LoadModule jk_module modules/mod_jk_2.0.46.dll
# Or. So documents
# Load mod_jk module for Apache and Tomcat handle connection
JkWorkersFile "E: / Apache / conf / workers.properties"
Mod_jk module # pointed out that the job required by the working paper workers.properties location
JkMount / servlet / * ajp13
JkMount / *. jsp ajp13
# All the servlet and jsp request Ajp13 the protocol through to the Tomcat, so Tomcat to handle
JkLogFile "E: / Apache/logs/mod_jk2.log"
JkLogLevel info

3, support php, according to the directory to modify the file.
# jarry added for php
ScriptAlias / php / "E: / php /"
AddType application / x-httpd-php. Php
Action application / x-httpd-php "/ php / php-cgi.exe"
AddType application / x-httpd-php. Php. Phtml. Php3. Php4
AddType application / x-httpd-php-source. Phps

4, will be saved as the following documents workers.properties to apache / conf under.
# Created by JarryLi
# Copyright all reserved!
# Email: jiarry@hotmail.com

# According to the existing installation directory to do modification
workers.tomcat_home = E: \ Tomcat5
# Let Tomcat know mod_jk module
workers.java_home = E: \ j2sdk1.4
# Allow mod_jk module know j2sdk
ps = \
worker.list = ajp13
# Module version, the existing ajp14, and not to amend the
worker.ajp13.port = 8009
# Port job, if not the occupier is not to amend
worker.ajp13.host = localhost
# Of this machine, if the above does not Apache host localhost, make consequential amendments to
worker.ajp13.type = ajp13
# Type
worker.ajp13.lbfactor = 1
# Agent number, do not modify
5, access a directory under apache, try visit the php files and jsp, if able to express the right to visit. If you have any questions, please double-check the log files, in general can solve.

Either




1, exe installation
2, select the directory
3, modify http.conf documents, increase directory
4, open the directory browser, and other features such as index file browser
5, add php

# Load the tomcat support added by jarry
# LoadModule jk2_module modules/mod_jk2.so

# For PHP 5 do something like this:
# LoadModule php5_module "E: / PHP/php5apache2.dll"
# AddType application / x-httpd-php. Php. Php3. Phps
# Configure the path to php.ini
# PHPIniDir "E: / php"

Php # # Add to amend its own installation directory under the php *. exe. added by jarry
ScriptAlias / php / "E: / PHP /"
Action application / x-httpd-php "/ php / php-cgi.exe"
# Action application / x-httpd-php "/ php / php.exe"
AddType application / x-httpd-php. Php. Phtml. Php3
AddType application / x-httpd-php-source. Phps

6, integrating apache + tomcat

[Sat Jun 23 20:01:23 2007] [error] [client 127.0.0.1] client denied by server configuration: E: / PHP / php-cgi.exe, referer: http://127.0.0.1/phpApp/
<Directory />
Options FollowSymLinks
AllowOverride None
# Order deny, allow
# Deny from all
Order allow, deny
Allow from all
Satisfy all
</ Directory>

Changed the configuration file is the configuration file apache 2.2.2 problem.

7, php.ini can be put on the windows or php root

8, add virtual directory
Alias / ut "E: / ut"
<Directory "E:/ut">
Options Indexes FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all
</ Directory>

10, integration apache2.2.2 + tomcat 5.5.16 mod_jk-apache-2.xxso

10.1
Download mod_jk-apache-2.2.4.so, put so documents on apahce modules folder
http://mirrors.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.23/

10.2
apahce / con / files under the new workers.properties Add Content
workers.tomcat_home = E: / Tomcat5.5 # allow mod_jk module to know the location of Tomcat
workers.java_home = E: / Jdk1.5 # allow mod_jk module to know the location of jre
ps = \
worker.list = ajp13 # module version
worker.ajp13.port = 8009 # port job, if not the occupier is not to amend
worker.ajp13.host = localhost # this machine, if the above does not Apache host localhost, make consequential amendments to
worker.ajp13.type = ajp13 # type
worker.ajp13.lbfactor = 1 # number of agent, need not be amended

Or are

JkAutoAlias E: / Tomcat5.5/webapps # tomcat's webapps directory absolute path
JkMount / *. jsp ajp13
JkMount / * / servlet / ajp13

10.3
Modify apahce / con / httpd.conf, add at the end, or to put these Add mod_jk.conf new document, entered through the httpd.conf loading (Include conf / mod_jk.conf).

LoadModule jk_module modules/mod_jk-apache-2.2.4.so
# Mod_jk here to download the file for your documents
JkWorkersFile "E: / Apache2/conf/workers.properties"
# Specify the address configuration file monitor tomcat
JkLogFile "E: / Apache2/conf/mod_jk.log"
# Record the log level of job
JkLogLevel info
# All the servlet and jsp request Ajp13 the protocol through to the Tomcat, so Tomcat to handle
JkMount / * / servlet / * ajp13
JkMount / servlet / * ajp13
JkMount / *. jsp ajp13

10.4
At TestApp directory separately set up php, jsp, serlvet document the test, if able to resolve how successful.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of TOMCAT + APACHE + JDK + MYSQL

  • lighttpd + fastcgi built a server how to preserve the status of server

    Requirements: server-side has much static files, there is much use of c + + to prepare the operational components necessary to carry out these functions on the external packaging Published Service, server-side state required to preserve the client (simila

  • servlet specification 2.2

    Introduction: Spring Security watch, when to see more use of the Servlet Listener, filter and so on. Filter done, listener never. Therefore want from the Internet to find a closer look at the servlet specification, go thorough investigation, there is no s

  • jBPM Development Getting Started Guide

    Although the workflow is still immature stage of development, not even a recognized standard. But its application has already been launched in the Express, indicating the market's demand for job-flow framework are urgent and enormous. Backgrounds of o

  • EJB ant script to deploy template works

    <? xml version = "1.0" encoding = "UTF-8"?> <! - Name Project name basedir build.xml file directory -> <project name="HelloWorld" basedir="."> <! - Property variables -> <! - The sour ...

  • spring myfaces hibernate richfaces

    1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j

  • Process migration from tomcat to websphere changes

    Process migration from tomcat to websphere changes Because customers use the web application server software used by different what tomcat5, tomcat6, websphere5.1, websphere6.1, weblogic8, and so on, and the software used inconsistent standards, ibm's

  • JAVA EE JSP_JNDI

    dsfdsa http://lindows.javaeye.com/admin/blogs/213348 Tomcat 6 with the connection pool data source configuration http://www.blogjava.net/ec2008/archive/2008/07/19/216063.html project: test Driver path: D: \ workspace \ test \ WebRoot \ WEB-INF \ lib ...

  • The EJB3 Persistence

    EJB3 persistence with Hibernate is very similar to the mechanism: Environment: Server: JBOSS5.0 Database: MySQL5.0 1. Set up a data source First of all, in jboss-5.0.0.GA \ server \ default \ deploy, the establishment of a database used to connect the dat

  • Servlet brief introduction

    Servlet brief introduction: Servlet is a small application server Are used to complete the B / S architecture, the client requests the response to treatment Platform independence, performance, able to run thread Servlet API for Servlet provides the s ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries