AJP/JK: Integration Technology for heterogeneous Web platforms

Source: Internet
Author: User

 

Tomcat Connector can connect tomcat to other web servers

 

1. AJP/JK Application Scenario:

Client-> Request->Web Server (IIS, Apache)-> Forward (redirect)->Servlet in Tomcat

Response Return in the opposite path

 

2. tomcat configuration

Tomcat configuration is relatively simple. You can place an AJP listener on a port, which can be completed through configuration or programming.

Configuration: In CONF/server. XML, a listener of AJP 8009 is running on port 1.3 by default.

 

<Connector Port = "8009" enablelookups = "false" redirectport = "8443" protocol = "AJP/1.3"/>

You can also add some:

<Connector Port ="8010"Enablelookups =" false "redirectport =" 8443 "DEBUG =" 0 "protocol =" AJP/1.3"

Usebodyencodingforuri = "true" uriencoding = "UTF-8"/>

 

Programming:

 

Org. Apache... coyoteconnector ajpconn = new coyoteconnector ();
Ajpconn. setprotocolhandlerclassname ("org. Apache. JK. server. jkcoyotehandler ");
Ajpconn. setaddress (inetaddress. gethostaddress ());
Ajpconn. setport (8010);
Ajpconn. setmaxprocessors (10 );
Ajpconn. setminprocessors (5 );
Ajpconn. setacceptcount (5 );
Ajpconn. setconnectiontimeout (0 );

Org. Apache... server Server = new org. Apache... embedded (...);

Server. addconnector (ajpconn );

Server. Start ();

 

 

3. IIS configuration

In fact, it is the configuration of ISAPI filter developed by Apache for IIS.

1. Download and install "Jakarta ISAPI redirector" (isapi_redirect.msi, you can find more information at tomcat-connectors)

2. On the ISAPI configuration page of IIS, browse and add isapi_redirect.dll

The rest is to tell isapi_redirect.dll which URLs are forwarded to which machine and which port

3. Create a new text file, rename it to "urimap. properties", or any name you like, and fill it with following content:

/Stock/Your. Project. Related. Path/* = mylistener1

/WebService/project2/* = mylistener2

4. Create a new text file, rename it to "workers. properties", or any name you like, and fill it with following content:

Worker. java_home = D:/Java/j2sdk1.4.2 _ 02

Worker. List = mylistener1, mylistener2

Worker. mylistener1.type = ajp13

Worker. mylistener1.port =8010

Worker. mylistener1.host = 192.168.0.5

Worker. mylistener2.type = ajp13

Worker. mylistener2.port = 8070

Worker. mylistener2.host = 192.168.0.4
 

5. Edit the Windows registry entry, specify the correct worker_file path as your "work. properties" path, and worker_mount_file path as your "urimap. properties" path.

HKEY_LOCAL_MACHINE/software/Apache Software Foundation/Jakarta ISAPI redirector/1.0:

Worker_file = C:/Jakarta-Tomcat/CONF/workers. Properties

Worker_mount_file = C:/Jakarta-Tomcat/CONF/urimap. Properties

Done.

 

4. Known Issue

If you changed property files of "Jakarta ISAPI redirector", maybe you shoshould restart IIS, even the host.

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.