달력

42024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

http://www.slholmes.org/journal/2006/7/15/apache-2-tomcat-5-mod_jk-xp.html

 

Apache 2 - Tomcat 5 - mod_jk - XP

Saturday, July 15, 2006 at 10:36AM
Posted by Registered CommenterScott L Holmes

Building a Better Development Environment In Ten Easy Steps

I've decided to finally get my act together and move all of my domains to eApps.com. When using webapps, eApps recommends that we use Apache+Tomcat using a bridge called mod_jk. This will help solve some interesting challenges:

       
  • The web ontology language OWL makes use of XML namespaces to provide its import function.   
  • I want to use Protege OWL as the ontology driven development (ODD) foundation for the development of Java web applications.   
  • I need localhost instances of Apache and Tomcat suitable for offline development   
  • I do not want to change the namespaces when I deploy. For instance I do not want to change the namespace http://localhost/ontologies... to http://www.slholmes.org/ontologies...

Given this as some starting points, I've managed to come up with the following plan:

       
  • Use my IBM Thinkpad laptop running Windows XP Service Pack 2 for all development.   
  • Use file Hosts to redirect http://www.slholmes.org/ to 127.0.0.1.   
  • Bridge Apache 2 to Tomcat 5 using mod_jk.

Prerequisites

Before configuring mod_jk, make sure that Apache and Tomcat are installed and fully functional.

I have successfully installed and initially configured both Apache and Tomcat. Apache was installed several months ago. I believe it is version 2.0.54. The only thing I've really done with it is initially get Rails working with FastCGI. Other than that, my instance of Apache is very much a default configuration. http://localhost/ simply displays the default Apache home page. Tomcat 5 was also installed several months ago. I have deployed Magnolia and CaCMS. I do not have any plans for Magnolia. Although Magnolia is a fine CMS, the user interface for the administrative functions are incredibly slow for significant development work - it's been this way for many years. CaCMS is exceptionally fast. CaCMS has a very simple design which I require because I do not plan to get heavy into Java development.

None of the applications that I've installed are required. Keep in mind, however, you'll want to make sure your local host instances are functioning correctly, so be sure to work with the servers for a while before attempting to connect them together. In my configuration, Apache is set to listen on port 80 and Tomcat is set to listen on port 8080 - both are the defaults.

Before configuring the servers (next section) make sure both Apache and Tomcat services have been stopped.

Configuring the Servers

Many tutorials and mailing list postings exist on the web that describe the mod_jk process. Given the constraints in my description above, my advise is to ignore them all except for the mod_jk documentation at the Tomcat site. None of the tutorials apply to recent versions of Apache, Tomcat or even mod_jk. Also, there are many varieties of mod_jk (jserv, mod_jk2, etc.) but they're all obsolete.

       
  1. Download the binary Apache module from the Win32 mod_jk Binaries folder.   
  2. Copy the downloaded file mod_jk-apache-2.0.55.so to Apache's modules folder.   
  3. Rename the copied file to mod_jk.so.   
  4. Edit the file server.xml which is located in Tomcat's conf folder - on my system that is C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf.   
  5. Locate the closing tag for the engine element: <\engine> and add the following just before the close tag:
    <Listener className="org.apache.jk.config.ApacheConfig" modJk="c:/PROGRA~1/APACHE~2/apache2/modules/mod_jk.so" />
    Make sure that you alter the path in the modJk attribute to reflect your installation of Apache.   
  6. Restart Tomcat   
  7. Verify that Tomcat created an auto-configuration file. You should have one or more new folders in Tomcat's conf folder. On my system, Tomcat created the following folder:
    c:/PROGRA~1/APACHE~1/TOMCAT~1.5/conf/auto/
    and in that folder, Tomcat generated the mod_jk auto-configuration file mod_jk.conf.   
  8. Edit the file httpd.conf which is located in Apache's conf folder - on my system that is C:\Program Files\Apache Group\Apache2\conf.   
  9. At the bottom of the httpd.conf file, add the following:
    Include c:/PROGRA~1/APACHE~1/TOMCAT~1.5/conf/auto/mod_jk.conf
    Make sure that you alter the path to reflect the location of the auto-configuration file (mod_jk.conf) that Tomcat generated..   
  10. Restart Apache

If everything is configured correctly, you'll be able to open your web browser, browse to http://localhost/ and get your default port 80 web page from Apache. Then, if you try to browse a web application like http://localhost/cacms you should get your default port 8080 web page from Tomcat.

'JAVA > WAS' 카테고리의 다른 글

PermGen Space  (0) 2007.02.13
아파치 튜닝 정리  (0) 2007.01.19
Apache 모듈 중 mod_expires -- 이미지 캐시  (0) 2006.02.22
[펌] [weblogic] 웹로직 문제점 방안  (0) 2006.02.07
[펌]웹 해킹을 통한 악성코드 유포사고 주의  (0) 2006.02.07
Posted by tornado
|