· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Linuxdoc Sgml/Tomcat-KLDP

Tomcat On Linux

Tomcat On Linux

ÁÖÈ¿½Ä nogadax@kldp.org

2Â÷ ¼öÁ¤ÀÏ : 2000,10,10 / 3Â÷ ¼öÁ¤ÀÏ : 2000,11,11 / 4Â÷ ¼öÁ¤ÀÏ : 2001,01/11
TomcatÀº The Jakarta ProjectÀÇ »ê¹°À̸ç ȨÆäÀÌÁö´Â http://jakarta.apache.org ÀÌ´Ù. Jakarta Project ÀÇ ¸ñÇ¥´Â ¿ÀǼҽºÈ­µÇ¾î °³¹ßµÈ Java Ç÷§ÆûÀ» ±â¹ÝÀ¸·Î ÇÏ¿© »ó¿ë Ç°ÁúÀÇ ¼­¹ö ¼Ö·ç¼Ç(Server Solution) À» Á¦°øÇϱâ À§ÇÔÀÌ´Ù. Tomcat Àº Java Servlet 2.2 ¿Í JavaServer Page 1.1 ÀÇ ¸í¼¼¸¦ ±¸ÇöÇÑ ÇüÅÂÀ̸ç À̸¦ "Servlet Container" ¶ó°í ÇÑ´Ù. TomcatÀº ±âŸÀÇ Web Server ¿Í °³¹ß Åø¿¡¼­ »ç¿ëµÉ ¼ö ÀÖÀ» »Ó¸¸¾Æ´Ï¶ó Apache ¿¡¼­ Plug-In ÇüÅ·Π»ç¿ëµÉ ¼ö ÀÖ´Ù. ±âŸ Tomcat Àº ±× ÀÚü°¡ Web Server ó·³ »ç¿ëµÉ ¼ö ÀÖÀ¸³ª ¾ÆÁ÷ ¾ÈÁ¤ÀûÀÌÁö ¸øÇØ ±ÇÀåµÇÁö ¾ÊÀ¸¸ç ±âÁ¸ÀÇ Web Server¿Í °°ÀÌ »ç¿ëÇÏ±æ ±ÇÀåÇÑ´Ù. TomcatÀÇ °³¹ßÁøÀº SUN,IBM ¹× Italio °°Àº ½Å»ý ȸ»ç¿Í °³ÀÎÀÇ °³¹ßÀÚµéÀÌ¸ç °³¹ß¿¡ °ü½ÉÀÖ´Â ±× ´©±¸µµ µ¿ÂüÇÒ ¼ö ÀÖÀ¸¸ç °ü½ÉÀÖ´Â ºÐµéÀº Jakarata ȨÀ» ã±â¹Ù¶õ´Ù. ±âŸ XML °ü·Ã ÆÐÅ°ÁöÀÎ cocoon ÀÇ È¨ÆäÀÌÁö´Â http://xml.apache.org ÀÌ´Ù. cocoon Àº XML ÆÄÀÏÀ» ¼­¹öÃø¿¡¼­ ó¸®ÇÏ¿© À̸¦ ºê¶ó¿ìÁ®¿¡ º¸¿©ÁÖ´Â ÆÐÅ°Áö·Î ¼³Ä¡µµ °£ÆíÇϹǷΠTomcat ¼³Ä¡½Ã¿¡ Ãß°¡·Î ¼³Ä¡Çϸé ÁÁÀ»µíÇÏ´Ù. This document can be freely translated and distributed. It,s released under the LDP License.

1. Tomcat Overview

Tomcat 3.1 ¹öÁ¯°ú ´Þ¸®, ÅèĹ 3.2 ¿¡´Â ¸¹Àº º¯È­°¡ ÀÌ·ç¾îÁø µí ÇÏ´Ù. ÅèĹ 3.1±îÁö´Â servlet ¹× JSP spec ¿¡ ´ëÇÑ ±â´ÉÀÇ ±¸Çö Â÷¿øÀ̶ó¸é 3.2 ¹öÁ¯ºÎÅÍ´Â ÆÛÆ÷¸Õ½º Æ©´× ,º¸¾È°ü·Ã º¸¿Ï(SSLµî..), ÅèĹ ÀÚü¿¡¼­ÀÇ ¾²·¹µå Ç®¸µ Áö¿ø ¹× mod_jserv °°Àº web-server-pluginÀÇ ÀçÀÛ¼º(mod_jk) µî À¥ ¾îÇø®ÄÉÀÌ¼Ç ¼­¹ö·ÎÀÇ µµ¾à °úÁ¤À¸·Î º¸¿©Áø´Ù. ¾ÕÀ¸·Î ³ª¿Ã 4.0 ¹öÁ¯ºÎÅÍ´Â ¸¹Àº ±â´ë¸¦ °É¾îµµ ÁÁÀ»µí ÇÏ´Ù. ´õ¿í ÀÚ¼¼ÇÑ »çÇ×Àº Tomcat °ü·Ã ¹®¼­¸¦ ÂüÁ¶Çϱ⠹ٶõ´Ù.

1.1 Release Notes For Tomcat

Tomcat 3.1

  • Servlet ¹× JSP spec ±âº» ±¸Çö
  • SSL Áö¿ø ¾ÈµÊ
  • Automatic servlet reloading Áö¿ø
  • WAR ÆÄÀÏ Áö¿ø
  • Netscape ¹× IIS Áö¿ø
  • ±âŸ..

Tomcat 3.2

  • Apache 1.3 ¹öÁ¯ ºÎÅÍ Áö¿ø
  • MS IIS 4.0 ÀÌÈÄ ºÎÅÍ Áö¿ø
  • MS Personal Web Server 4.0 ¹öÁ¯ºÎÅÍ Áö¿ø
  • Netscape Enterprise server 3.0 ºÎÅÍ Áö¿ø
  • Tomcat 3.1 ÀÌÈÄ ¸¹Àº ¹ö±× ¼öÁ¤
  • Tomcat 3.1 ÀÌÈÄ Ã³À½À¸·Î ÆÛÆ÷¸Õ½º Æ©´×
  • ÅèĹ ÀÚü¿¡¼­ Threaded Pooling Áö¿ø
  • mod_jservÀÇ ÀçÀÛ¼ºÆÇ mod_jk Áö¿ø
  • mod_jserv ¹× mod_jk ¸ðµÎ Áö¿ø
  • mod_jk¸¦ ÅëÇÑ Ajpv13 Áö¿ø
  • ±âŸ..

Tomcat 3.2.1

  • ÅèĹ 3.2 ¹öÁ¯¿¡ ±â¹ÝÇÑ ¹ö±× ¼öÁ¤ÆÇ
  • ÅèĹ 3.2 ¹öÁ¯¿¡ ´ëÇÑ º¸¾È(security) °ü·Ã ¾÷µ¥ÀÌÆ®ÆÇ
  • SSL Áö¿ø
  • WEB-INF µð·ºÅ丮³»ÀÇ JSP ¿äû Çã¿ë ¾ÈµÊ( ¿¹: /WEB-INF/dummy.jsp)
  • JDBC ¿¹¿Ü 󸮿¡ ´ëÇÑ µð¹ö±ëÀ» º¸Á¶ÇϱâÀ§ÇØ JDBC ¿¹¿Ü¿¡ ´ëÇÑ ±â·Ï ó¸®(JDBCRealm)
  • ±âŸ..

Tomcat 4.0

  • 2001³â 1¿ù ÇöÀç °³¹ßÁß
  • ÅèĹ 3.x ¹öÁ¯°ú´Â ¸Å¿ì ´Ù¸¥ ±¸Á¶·Î °³¹ßÁß(Ä«Å»¸®³ª ¾ÆÅ°ÅØÃÄ)
  • Servlet 2.3 ¹× JSP 1.2 Áö¿ø
  • ±âŸ..

1.2 ÅèĹÀÇ ½ÇÇà ¸ðµå

A. Stand_alone


 a. ÅèĹ È¥ÀÚ¼­ À¥ ¼­¹ö ¹× Servlet ÄÁÅ×ÀÌ³Ê ±â´É ¸ðµÎ ó¸® 
    Áï, µ¶ÀÚÀûÀÎ À¥ ¾îÇø®ÄÉÀÌ¼Ç ¼­¹öÀÌ´Ù. 
 b. ÅèĹÀÌ Stand-alone ÀÏ °æ¿ì Static Fileµî¿¡ ´ëÇÑ Ã³¸®´Â CPU ³¶ºñÀÓ. 
    static file ¿¹ : HTML, Image files
 c. Apache ó·³ È®À强ÀÌ(perl,php) ¾ø°í Á¤ÀûÈ­ÀϵîÀÇ Ã³¸®°¡ °ß°íÇÏÁö ¸øÇÔ.
 d. ±×·¯¹Ç·Î Apache °°Àº À¥¼­¹ö¿Í º´ÇàÇÏ¿© ó¸®ÇÏ´Â °ÍÀÌ È¿À²ÀûÀÓ. 

B. In-Process

 a. Apache2.0 °ú °°Àº Multi-Threaded-Server °¡ ÇÊ¿äÇÔ. 
 b. out-process ¿¡ ºñÇØ ºñ±³Àû ºü¸¥ ÆíÀÓ. 
 c. apacheµîÀÇ À¥¼­¹ö ÇÁ·Î¼¼½º³»¿¡¼­ JVM µîÀÌ ½ÇÇàµÊ.
    ÀÌ´Â web-server-plugin¿¡ ÀÇÇØ ±¸ÇöµÊ.
 d. JNI »ç¿ë 

C. Out-Process

 a. TCP/IP¼ÒÄÏÀ» »ç¿ëÇÏ´Â IPC »ç¿ë 
 b. À¥¼­¹öÀÇ ÇÁ·Î¼¼½º¹Û¿¡¼­ JVMÀÌ ½ÇÇà 
 c. ÇÁ·ÎÅäÄݷδ Ajpv12 ¿Í Ajpv13 ¸¦ »ç¿ë 

1.3 Web Server Plugin

* Web-Server-PluginÀº ÅèĹÀÌ À¥¼­¹ö¿Í º´ÇàÇÏ¿© »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ¸¸µé¾îÁø ¸ðµâ

* Ŭ¶óÀ̾îÆ®ÃøÀÇ Servlet ȤÀº JSP´ëÇÑ ¿äûÀº À¥¼­¹ö°¡ Web-Server-plugin ¿¡°Ô Àü¼Û

* ¶ÇÇÑ, Web-Server-Plugin Àº Àü´Þ¹ÞÀº ¸Þ½ÃÁö¸¦ ÅèĹ¿¡°Ô Àü¼Û.

* Áï, Web-Server-PluginÀº À¥¼­¹ö(Apache)¿Í ÅèĹ»çÀÌÀÇ ÀÇ»ç¼ÒÅë ´ç´ãÀÚÀÓ.

* ÅèĹ3.1 ¹öÁ¯ÀÇ web-server-pluginÀº mod_jserv.so ¸¸ Áö¿øÇÑ´Ù.

* ÅèĹ3.2 ¹öÁ¯ÀÇ Web-Server-PluginÀº mod_jserv.so ¿Í mod_jk.so µî µÎ°¡Áö¸¦ Áö¿øÇÑ´Ù.

* Åë½ÅÀ» µ½±â À§ÇØ web-server-plugin°¡ ÇÊ¿äÇÑ °ÍÀº Æ÷Æ®¿Í ÇÁ·ÎÅäÄÝ(Ajp..)ÀÓ.

* ¾ÆÆÄÄ¡ ¹× ÅèĹ»çÀÌ¿¡¼­ À§ÀÇ Æ÷Æ®¿Í ÇÁ·ÎÅäÄÝ·Î ÀÎÇØ Åë½ÅÀÌ °¡´ÉÇÏ¸ç ±âŸ È£½ºÆ® Á¤º¸µµ ÇÊ¿ä.

* ´ÙÀ½Àº mod_jserv.so ¿Í mod_jk.so ÀÇ ºñ±³ÀÌ´Ù.

a. mod_jserv.so

 -±¸Á¶°¡ º¹ÀâÇÏ´Ù. 
 -SSLÀ» Áö¿øÇÏ´Â HTTPS Áö¿ø ¾ÈµÊ 
 -Ajpv12 ¸¸ Áö¿ø 
 -¼­ºí¸´ Áö¿ø ¹öÁ¯ ³·À½ ..
 -Tomcat 3.1, 3.2¿¡¼­ ¸ðµÎ Áö¿ø  
 -±âŸ..

b. mod_jk.so

 -±¸Á¶°¡ º¹ÀâÇÏÁö ¾Ê´Ù.
 -mod_jserv.so ¸¦ ¾à°£¸¸ º¯°æÇÑ °ÍÀÌ ¾Æ´Ï´Ù.
 -mod_jserv ¸¦ ¿ÏÀüÈ÷ ÀçÀÛ¼ºÇÑ °ÍÀÌ´Ù. 
 -¾ÆÆÄÄ¡, ³Ý½ºÄÉÀÌÇÁµîÀ» Áö¿ø 
 -¾ÆÆÄÄ¡ 1.3.x ¹× ¾ÆÆÄÄ¡ 2.x.x Áö¿ø
 -Tomcat 3.2¿¡¼­¸¸ Áö¿ø  
 -SSL Áö¿ø 
 -Ajpv 12 ¹× Ajpv13 ¸ðµÎ Áö¿ø 
 -±âŸ 

2. Tomcat 3.1 Getting Started

ÀÚ¹Ù ±â¹ÝÀÎ tomcat Àº ¾ÆÆÄÄ¡ Áø¿µÀÇ ¶Ç ´Ù¸¥ »ê¹°ÀÌ´Ù. JSDK(servlet)ÀÇ ¼³Ä¡ ¾øÀÌ tomcat¸¸ÀÇ ¼³Ä¡·Î servlet°ú jsp¸¦ ¹Ù·Î »ç¿ëÇÒ ¼ö °¡ ÀÖ´Ù.

TomcatÀº JSP ȯ°æÀ» Áö¿øÇÏ´Â Servlet Container ÀÌ´Ù. Servlet Container´Â »ç¿ëÀÚ¸¦ ´ë½ÅÇÏ¿© Servlet À» °ü¸®ÇÏ°í Invoke ÇÏ´Â ½Ç½Ã°£ ½©(Runtime Shell)ÀÌ´Ù.

ÀÌ´Â ±âÁ¸ÀÇ Servlet À» Áö¿øÇÏ´Â Jserv ¿Í´Â ´Ù¸£¸ç Tomcat °ú ´ëÇ¥ÀûÀÎ Â÷ÀÌ´Â JSDK °¡ ÇÊ¿ä¾ø´Ù´Â °ÍÀ̸ç Jserv´Â Servlet 2.0 ±îÁö¸¸À» Áö¿øÇϳª TomcatÀº Servlet 2.2¿Í JSP 1.1À» Áö¿øÇÑ´Ù´Â °ÍÀÌ´Ù.

Servlet ContainerÀº Å©°Ô ¼¼°¡Áö·Î ºÐ·ùµÇ¸ç ´ÙÀ½°ú °°´Ù.

1.Stand-alone Servlet Container : Tomcat ÀÚü°¡ ÀÚ¹Ù ±â¹ÝÀÇ Web Server·Î »ç¿ëµÈ´Ù. ÀÌ´Â Tomcat ¿¡¼­ Default mode ÀÌ´Ù.

2.In-process Servlet Container : Web Server Plugin°ú Java Container¸¦ Á¶ÇÕÇÑ ±¸Çö ÇüÅÂÀ̸ç Apache µîÀÇ Web Server ¿¡ Ãß°¡ÇÏ¿© »ç¿ëÇÏ´Â ÇüÅÂÀÌ´Ù. ÇϳªÀÇ ÇÁ·Î¼¼½º³»¿¡ ¸ÖƼ ¾²·¹µå¸¦ ±¸ÇöÇÑ ÇüÅÂÀ̸ç ÀÌ´Â ÁÁÀº ÆÛÆ÷¸Õ½º(performance)¸¦ °¡Áö³ª ÇϳªÀÇ ÇÁ·Î¼¼½º³»¿¡¼­ °¢ ¼­ºí¸´ÀÌ ¸ÖƼ ¾²·¹µåÈ­µÇ¾î ±¸ÇöµÇ¹Ç·Î ¾²·¹µåÀÇ µ¿½Ã ½ÇÇà °³¼ö°¡ Á¦ÇѵȴÙ( limited Scalability). ±¸Çö ÇüÅ´ Web Server PluginÀÌ JVMÀ» Web ServerÀÇ ÁÖ¼Ò(Address) ¿µ¿ª³»¿¡ open ÇÑ ÈÄ ±× ÁÖ¼Ò ¿µ¿ª³»¿¡¼­ JVM ÀÌ ½ÇÇàµÉ ¼ö ÀÖµµ·Ï ÇÏ°Ô ÇÑ´Ù. ¼­ºí¸´À» ½ÇÇàÇÏ·Á´Â ¾î¶² ¿äûÀÌ ¿À¸é PluginÀº Á¦¾î±ÇÀ» ¹Þ¾Æ Java Container¿¡°Ô °Ç³×ÁØ´Ù.

3.Out-of-process Servlet Container : In-process Servlet Container ¿Í ºñ½ÁÇϳª JVM Àº Web Server ÁÖ¼Ò¿µ¿ªÀÇ ¿ÜºÎ¿¡¼­ ½ÇÇàµÈ´Ù. Web Server Plugin °ú Java Container(JVM) Àº IPC ¸ÞÄ¿´ÏÁò(´ë°³ TCP/IP ¼ÒÄÏ)À» »ç¿ëÇÏ¿© Åë½ÅÇÑ´Ù. ¼­ºí¸´À» ½ÇÇàÇÏ·Á´Â ¾î¶² ¿äûÀÌ µé¾î¿À¸é plugin Àº Á¦¾î±ÇÀ» ¹Þ¾Æ IPC ¸ÞÄ«´ÏÁòÀ» »ç¿ëÇÏ¿© Java Container(JVM) ¿¡°Ô °Ç³×ÁØ´Ù. Out-of-process ¿¡¼­´Â ¿äû¿¡ ´ëÇÑ ÀÀ´ä½Ã°£(response time) ÀÌ In-processº¸´Ù´Â ÁÁÁö ¾ÊÁö¸¸ scalability ³ª stability µî¿¡¼­ ÁÁ´Ù.

±âŸ servlet ÀÇ °æ¿ì ¸Å¹ø ÄÄÆÄÀÏÇÒ¶§¸¶´Ù ¾ÆÆÄÄ¡ÀÇ Àç±âµ¿¾øÀÌ ¹Ù·Î ½ÇÇà °á°ú¸¦ º¼ ¼ö ÀÖ¾î °³¹ßÀÚ¿¡°Ô´Â ´õ¾øÀÌ Áñ°Ì´Ù. (ÇÏÁö¸¸ ´ëü·Î ÀçÄÄÆÄÀÏµÈ ¼­ºí¸´ Àº ¹Ù·Î ·ÎµùÀÌ ¾ÈµÇ°í ºê¶ó¿ìÁ®¸¦ Á׿´´Ù°¡ ´Ù½Ã ½ÃÀÛÇÏ¸é µÇ´Âµ¥ ÀÌ°Ô ¿ÖÀÌ·±Áö ¾Æ½Ã´Â ºÐÀº ¸ÞÀÏÀ̳ª Á¦ Ȩ¿¡ ±ÛÁ» ³²°ÜÁÖ¼¼¿ä)

±âŸ ÀÌ ¹®¼­´Â Tomcat¿¡ ´ëÇÑ ÃÖ¼ÒÇÑÀÇ ¹®¼­À̹ǷΠTomcat ¿¡ ´ëÇÑ ´Ù¸¥ ¹®¼­µéµµ ÂüÁ¶Çϱ⠹ٶõ´Ù. °¡Àå ÀûÀýÇÑ Âü°í »çÀÌÆ®´Â Jakarta ÀÇ È¨ÆäÀÌÁöÀÌ¸ç ±âŸ http://kldp.org ¿¡¼­ "Tomcat" À¸·Î °Ë»öÀ» ÇÏ¿© ±è»ó¼ö´ÔÀÇ Tip¹®¼­¸¦ ã°Å³ª http://webdox.co.kr ¿¡¼­ ±è¹Î½Ä´Ô°ú ±è¼¼°ï´ÔÀÌ ÇÔ²² ¾´ ¹®¼­¸¦ ã¾Æ ÂüÁ¶Çϱ⠹ٶõ´Ù.

(ÇÊÀÚÀÇ È¨ÆäÀÌÁö´Â http://user.chollian.net/~nogadax ÀÌ°í ¸ÞÀÏÀ» ÅëÇÑ Áú¹®Àº µÉ¼ö ÀÖÀ¸¸é »ï°¡ÇØÁÖ¼¼¿ä. Á¦ ȨÀÇ Áú¹® °Ô½ÃÆÇÀ» ÀÌ¿ëÇØÁֽñ⠹ٶø´Ï´Ù.)

3. Tomcat 3.1 ¼³Ä¡

ÇÊÀÚÀÇ Å×½ºÆ®È¯°æÀº ´ÙÀ½°ú °°´Ù

  • Accel Linux 6.1
  • postgreSQL 7.0.2
  • JDK 1.2.2
  • Apache 1.3.12
  • Tomcat 3.1
  • cocoon 1.8

¿©±â¿¡¼­ ¼Ò°³ÇÏ´Â ¼³Ä¡´Â Apache Plugin ÇüÅÂÀÌ´Ù.

3.1 Tomcat 3.1 ¼³Ä¡

1. ¼³Ä¡Àü¿¡ ¾ÆÆÄÄ¡¿ÍÀÇ ¿¬µ¿À» À§ÇØ ¾ÆÆÄÄ¡´Â DSO ·Î ÄÄÆÄÀϵǾî ÀÖ¾î¾ß ÇÑ´Ù.

Apache Configure ¹× ÄÄÆÄÀÏ ¿¹

[root@nogadax src]$ ./configure --prefix=/usr/local/apache \
--enable-module=most \
--enable-shared=max
[root@nogadax src]$ make
[root@nogadax src]$ make install 

2. JDK1.1.x ¹öÁ¯ ÀÌ»óÀÌ ¼³Ä¡µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù.

3. http://jakarta.apache.org/downloads/binindex.html ¿¡¼­ ÀÌ¹Ì ÄÄÆÄÀÏµÈ ¹ÙÀ̳ʸ® ÆÐÅ°Áö(jakarta-tomcat.tar.gz)¸¦ ´Ù¿î¹Þ°í mod_jserv.so ¸¦ ´Ù¿î¹Þ´Â´Ù.

4. Àû´çÇÑ µð·ºÅ丮¿¡ ¹ÙÀ̳ʸ® ÆÐÅ°ÁöÀÇ ¾ÐÃàÀ» Ç®¸é ¼³Ä¡ ¿Ï·áÀÌ´Ù.

3.2 ¼³Á¤Çϱâ

1. ´Ù¿î¹ÞÀº mod_jserv.so ¸¦ (¾ÆÆÄÄ¡ µð·ºÅ丮ÀÇ) apache/libexec µð·ºÅ丮¿¡ º¹»çÇÑ´Ù.

2. TOMCAT_HOME°ú JAVA_HOME ȯ°æº¯¼ö¸¦ ¼³Á¤ÇÑ´Ù.

¸¸¾à tomcat ÀÇ °æ·Î°¡ /usr/local/jakarta-tomcat À̸é /etc/profile µîÀÇ ÆÄÀÏ¿¡ ´ÙÀ½Ã³·³ ¼³Á¤ÇÑ´Ù.

export TOMCAT_HOME=/usr/local/jakarta-tomcat

JAVA_HOME ¶ÇÇÑ ¸¶Âù°¡Áö·Î jdkÀÇ °æ·Î°¡ /usr/local/jdk1.2.2 ÀÌ¸é ´ÙÀ½°ú °°´Ù.

export JAVA_HOME=/usr/local/jdk1.2.2

±×·± ÈÄ ¼³Á¤ È­ÀÏÀ» ½ÇÇàÇÏ¿© º¯¼ö¸¦ ¸Þ¸ð¸®·Î ¿Ã¸®¸é µÈ´Ù.

    (¿¹ : [root@nogadax local]$  .  /etc/profile )

3. tomcat µð·ºÅ丮ÀÇ conf µð·ºÅ丮¿¡ Á¸ÀçÇÏ´Âtomcat.conf ¸¦ ¾Æ·¡Ã³·³ ¾ÆÆÄÄ¡ µð·ºÅ丮 ¹ØÀÇ conf µð·ºÅ丮³»ÀÇ httpd.conf ÆÄÀÏÀÇ Á¦ÀÏ ¸¶Áö¸·¿¡ Ãß°¡ÇÏ¸é µÈ´Ù.

    Include  /usr/local/jakarta-tomcat/conf/tomcat.conf

±×·± ÈÄ tomcat.conf¸¦ ¼öÁ¤ÇÑ´Ù. ¾Æ·¡ÀÇ ¶óÀÎÀ» Ãß°¡ÇÏ¸é µÈ´Ù.(tomcat_test´Â ¿¹Á¦ µð·ºÅ丮ÀÓ)

ApJServMount /tomcat_test /root

tomcat.conf ¼öÁ¤ ÈÄ webapps µð·ºÅ丮¹Ø¿¡ tomcat_test µð·ºÅ丮¸¦ ¸¸µç ÈÄ tomcat_test µð·ºÅ丮¿¡ WEB-INF µð·ºÅ丮¸¦ ¸¸µç´Ù. ±×·± ÈÄ TOMCAT_HOME/conf/web.xmlÀ» »õ·Î ¸¸µç WEB-INF µð·ºÅ丮¿¡ º¹»çÇÑ´Ù.

Âü°í·Î Tomcat 3.1¿¡ Apache1.3.12 ¹öÁ¯À̸é À§ÀÇ ¼³Á¤ ÈÄ TomcatÀ» ½ÇÇàÇϸé ÀÚµ¿À¸·Î tomcat-apache.conf ÆÄÀÏÀÌ »ý¼ºµÈ´Ù. ±×·¯¸é Tomcat Á¾·á ÈÄ tomcat.conf¸¦ ÀûÀýÈ÷ ¹é¾÷ ÈÄ tomcat-apache.conf¸¦ tomcat.conf ·Î rename ÇÏ¿© »ç¿ëÇصµ µÈ´Ù.

3.3 Tomcat 3.1 ½ÇÇàÇϱâ

¸ÕÀú tomcat À» ½ÇÇàÇÑ ÈÄ¿¡ ¾ÆÆÄÄ¡¸¦ ½ÇÇàÇÑ´Ù.

1. tomcat ½ÇÇàÀº tomcat ÀÇ bin µð·ºÅ丮ÀÇ "tomcat.sh start" ³ª "startup.sh" ¸¦ ½ÇÇàÇÑ´Ù.

2. ¾ÆÆÄÄ¡¸¦ ½ÇÇàÇÑ´Ù.(apachectl start)

3.4 Á¾·áÇϱâ

1. tomcatÀ» Á¾·áÇÑ´Ù. ½ÇÇට¿Í ¸¶Âù°¡Áö·Î tomcat ÀÇ bin µð·ºÅ丮ÀÇ "tomcat.sh stop" ³ª "shutdown.sh" ¸¦ ½ÇÇàÇÑ´Ù.

2. ¾ÆÆÄÄ¡¸¦ Á¾·áÇÑ´Ù.(apachectl stop)

3.5 Tomcat 3.1 Å×½ºÆ®Çϱâ

Å×½ºÆ®´Â URL ÀÌ http://210.110.144.235 À϶§¿¡ ´ÙÀ½°ú °°´Ù.

http://210.110.144.235/examples/servlets

http://210.110.144.235/examples/jsp

3.6 Servlet ÄÄÆÄÀÏ

Servlet ÀÇ ÄÄÆÄÀÏÀ» À§ÇØ tomcat µð·ºÅ丮 ¹ØÀÇ lib µð·ºÅ丮ÀÇ "servlet.jar" À» CLASSPATH ¿¡ µî·ÏÇÏ¸é µÈ´Ù. (ÀÌ¿Ü¿¡ ´Ù¸¥ ¹æ¹ýÀÌ ÀÖÀ¸¸é ÀúÀÇ È¨À̳ª ¸ÞÀÏ·Î º¸³»ÁÖ½Ã¸é °í¸¿°Ú½À´Ï´Ù.)

¿¹ : export  CLASSPATH=$CLASSPATH:/usr/local/jakarta-tomcat/lib/servlet.jar

±×·± ÈÄ servlet ÇÁ·Î±×·¥µéÀ» ÄÄÆÄÀÏÇÏ¸é µÈ´Ù.

4. Jakarta-tomcat/conf µð·ºÅ丮ÀÇ server.xml º¸±â

tomcat¿¡¼­server.xml Àº Áß¿äÇÑ È­ÀÏÀÌ´Ù. È­Àϳ»ÀÇ Áß¿äÇÑ ¼³Á¤¿ä¼Ò·Î´Â Server,Logger,ContextManager ,ContextInterceptor¿Í RequestInterceptor,Connector,Context µîÀÌ ÀÖÀ¸¸ç ±×Áß¿¡ ±âÃÊÀûÀ¸·Î ¾Ë¾Æ¾ß ÇÒ ºÎºÐÀº Context °¡ ¾Æ´Ñ°¡ ½Í´Ù. ÇÊÀÚ°¡ ¸ðµç ¿ä¼Ò¿¡ ´ëÇØ ¾Ë°í ÀÖÁö´Â ¾ÊÀº »óÅÂÀ̸ç ÃÖ¼ÒÇÑÀÇ ºÎºÐ¸¸ ÁüÀÛÇÏ°í ÀÖÀ» »ÓÀÌ´Ù.

Server.xml ¿¡¼­ Context ¼³Á¤ºÎºÐÀº Web Application(ServletÀ̳ª JSP)ÀÌ À§Ä¡ÇÒ Àå¼Ò¸¦ ¼³Á¤Çϸç WEB »óÀÇ PATH(°æ·Î)¸¦ ¼³Á¤ÇÑ´Ù. ±âŸ ÀçÄÄÆÄÀÏµÈ ¼­ºí¸´À» ÀÚµ¿À¸·Î Àç·ÎµùÇÑ´Ù.

Âü°í·Î Context(webapps,work)ÀÇ base µð·ºÅ丮´Â ContextManager ÀÇ HomeÀ̸ç TOMCAT_HOME ÇÏ°í´Â Àǹ̰¡ ´Ù¸£´Ù. ¸¸¾à ContextManager ÀÇ Home ÀÌ /usr/local/jakarta-tomcat ÀÌ¸é »ùÇÿëÀÇ Web Application ÀÌ Æ÷ÇÔµÈ webapps ÀÇ Àý´ë°æ·Î´Â /usr/local/jakarata-tomcat/webapps ÀÌ´Ù. ½ÇÁ¦·Î »ùÇÿëÀÇ web application(servlets,JSPs) °¡ µé¾î ÀÖ´Â °æ·Î´Â /usr/local/jakarta-tomcat/webapps/examples/WEB-INF/classes ÀÌ´Ù.

±âŸ work µð·ºÅ丮´Â Tomcat ½ÇÇàÁß Áß°£ ÇüÅÂÀÇ ÆÄÀÏÀÌ À§Ä¡Çϸç(¿¹¸¦ µé¾î ÄÄÆÄÀÏµÈ JSP ÆÄÀÏ) ÀÌ µð·ºÅ丮°¡ Tomcat ½ÇÇàÁß¿¡ »èÁ¦µÈ´Ù¸é JSP °¡ ½ÇÇàÀÌ µÇÁö ¾Ê´Â´Ù.

¾Æ·¡´Â È­ÀÏÀº ¸ðµç ³»¿ëÀº ¾Æ´ÏÁö¸¸ ´ÙÀ½ÀÇ ºÎºÐ¸¸ º¸ÀÚ.

<Context path="/examples" docBase="webapps/examples" debug="0" reloadable="true">
</Context>

<Context path="/pgsql" docBase="webapps/pgsql" debug="0" reloadable="true"> 
</Context>

<Context path="/websql" docBase="webapps/websql" debug="0" reloadable="false"> 
</Context>

Context´Â ÀÌÀüÀÇ jserv ¿¡¼­ ¸®Æ÷ÁöÅ͸® ¿ªÈ°À» ÇÏ´Â ZONE °ú °°Àº °ÍÀ¸·Î º¸ÀδÙ.

Á¦ÀÏ À§ÀÇ examples ´Â »ùÇÿëÀÇ ¿¹Á¦°¡ ÀÖÀ¸¸ç tomcat ÀÇ ¼³Ä¡ ÈÄ web »ó¿¡¼­ ¹Ù·Î ½ÇÇàÇÒ ¼ö°¡ ÀÖ´Ù. »ùÇÿëÀÇ ¿¹Á¦´Â examples/WEB-INF/classes ¿¡ ÀÖ´Ù.

»ùÇÿëÀÎ examples ÀÇ Hello ¼­ºí¸´À» ½ÇÇàÇϱâ À§ÇÑ À§ÀÇ WEB »óÀÇ ÁÖ¼Ò´Â http://your_host_address/examples/servlet/Hello ÀÌ´Ù.

web»ó¿¡¼­ examples¸¦ /examples/servlet ·Î »ç¿ëÇÏ´Â ÀÌÀ¯´Â ´ÙÀ½°ú °°´Ù.

tomcat ÀÌ ½ÃÀ۵Ǹé conf µð·ºÅ丮ÀÇ server.xml À» ÂüÁ¶ÇÑ ÈÄ tomcat-apache.conf¸¦ ÀÚµ¿ ¼³Á¤ÇÑ´Ù. ±× Áß¿¡ Context ¿¡ ¼³Á¤µÈ PATH ¸¦ ÂüÁ¶ÇÏ¿© ÀÚµ¿À¸·Î ÀûÀýÇÏ°Ô ¼³Á¤ÇÑ´Ù. ¹Ù·Î ÀÌÆÄÀÏ(tomcat-apache.conf)¿¡ examples ¸¦ µé¾î°¡´Â °æ·Î°¡ examples/servlet ·Î ¼³Á¤µÈ´Ù.(¿©±â¿¡ ´ëÇÑ »çÇ×Àº tomcat ½ÇÇàÈÄ ÀÌ ÆÄÀÏÀ» ÂüÁ¶Çϱ⠹ٶõ´Ù.) tomcat-apache.conf °¡ ¼³Á¤µÈ ÈÄ¿¡ ¾ÆÆÄÄ¡¸¦ ±âµ¿ÇÏ¸é ¾ÆÆÄÄ¡´Â Tomcat¿¡ ÀÇÇØ ÀÚµ¿ ¼³Á¤µÈ tomcat-apache.conf ¸¦ ÂüÁ¶ÇÏ¿© ½ÇÇàµÈ´Ù.

reloadable="true"´Â Auto-reloadable À̸ç falseÀ̸é À¥ ¾îÇø®ÄÉÀ̼ÇÀÇ Auto-reloadable ÀÌ µÇÁö ¾Ê´Â´Ù.

±âŸ pgsql °ú websql Àº ÇÊÀÚ°¡ Å×½ºÆ®¸¦ À§ÇØ ¸¸µç °ÍÀÌ´Ù. ÀÌ µÎ°³ÀÇ µð·ºÅ丮´Â webapps µð·ºÅ丮¿¡ »ý¼ºÇÏ¿´°í °¢°¢ÀÇ µð·ºÅ丮¿¡´Â ¶Ç ´Ù¸¥ ÇÏÀ§ µð·ºÅ丮¸¦ ¸¸µé¾î¾ß ÇÑ´Ù.(WEB-INF/classes) ´ÙÀ½Àº ±× ¿¹ÀÌ´Ù.

webapps/pgsql/WEB-INF/classes
webapps/websql/WEB-INF/classes

ÃÖÁ¾ µð·ºÅ丮ÀÎ classes ¿¡ ¼­ºí¸´ Ŭ·¡½ºµéÀÌ µé¾î°¡¸é µÇ¸ç tomcat ½ÇÇàÈÄ tomcat µð·ºÅ丮ÀÇ "tomcat-apache.conf" ¸¦ º¸¶ó

´ÙÀ½Àº pgsqlÀ» ºê¶ó¿ìÁ®¿¡¼­ »ç¿ëÇÏ´Â URL ¿¹ÀÌ´Ù.

http://210.110.144.235/pgsql/servlet/example_servlet

À§ÀÇ example_servlet ´Â ¼­ºí¸´(example_servlet.class)À̸ç "pgsql/WEB-INF/classes" ÀÌ ÀÖ´Ù.

5. server.dtd ¼³¸í

ÀÌÀåÀº º¸´Ù Àü¹®ÀûÀÎ ³»¿ëÀ̳ª XML ¿¡ °ü·ÃµÈ ³»¿ëÀ̹ǷΠÇʵ¶»çÇ×ÀÌ ¾Æ´Ï´Ù. °ü½ÉÀÖ´Â ºÐ¸¸ Àо±â ¹Ù¶õ´Ù.

¶ÇÇÑ ÀÌ ÀåÀº server.dtd ¿¡ ´ëÇØ ¿Ïº®ÇÑ ¼³¸íÀÌ ¾Æ´Ï¹Ç·Î °ü½ÉÀÖ´Â ºÐÀº XML °ü·Ã ¹®¼­¸¦ Âü°íÇÏ±æ ¹Ù¶õ´Ù.

server.dtdÀº XML ¸¶Å©¾÷ ¾ð¾îÀÇ ¸ÞŸ ÆÄÀÏÀÎ DTD(Document Type Declarations)ÆÄÀÏÀ̸ç, tomcat ¼³Á¤ ÆÄÀÏÀÎ server.xmlÆÄÀÏ¿¡¼­ »ç¿ëµÇ´Â ¸¶Å©¾÷¾ð¾î¸¦ Á¤ÀÇÇÏ´Â ÆÄÀÏÀÎ TOMCAT_HOME/conf/server.dtd ÆÄÀÏÀÌ´Ù. Áï, server.dtd´Â server.xml ÀÇ ¹®¹ýÀ» Á¤ÀÇ ÇÏ´Â ÆÄÀÏÀÌ µÇ´Â ¼ÀÀÌ´Ù.

Âü°í·Î ¸¶Å©¾÷ ¾ð¾îÀÇ ¸ÞŸ ÆÄÀÏÀ̶õ »õ·Î¿î ¸¶Å©¾÷ ¾ð¾î¸¦ Á¤ÀÇÇÏ´Â ÆÄÀÏÀÌ´Ù. ¶ÇÇÑ, tomcatÀº server.dtd ¿¡¼­ Á¤ÀÇµÈ ³»¿ëÀ» ÂüÁ¶ÇÏ¿© server.xml ÀÇ ³»¿ëÀ» ÀÌÇØ ÇÒ ¼ö ÀÖ°Ô µÇ¸ç, »ç¿ëÀÚ ¶ÇÇÑ server.dtd ¿¡¼­ Á¤ÀÇµÈ ¹®¹ý(?)´ë·Î server.xml¿¡ °¢ ¼³Á¤µîÀ» ÇÏ°Ô µÈ´Ù.

 <?xml version="1.0" encoding="ISO-8859-1"?>

À§ÀÇ ¶óÀÎÀº XML ÆÄÀÏÀÓÀ» ³ªÅ¸³½´Ù.

 <!ELEMENT Server (ContextManager+)>

Server ¶ó´Â ¿ä¼Ò(element)¸¦ Á¤ÀÇ Çϸç (ContextManager) ´Â server ¶ó´Â ¿ä¼Ò¿¡ Æ÷ÇԵȴÙ. (ContextManager+) ¿¡¼­ "+"´Â Çϳª ÀÌ»óÀ» ÀǹÌÇÏ¸ç ¿©±â¼­´Â ContextManager À̶ó´Â ¿ä¼Ò°¡ Server ¿ä¼Ò³»¿¡ ÃÖ¼ÒÇÑ Çϳª°¡ ÀÖ¾î¾ß Çϸç Çϳª ÀÌ»ó À־ µÈ´Ù´Â ÀǹÌÀÌ´Ù. ´ÙÀ½Àº »ç¿ë ¿¹ÀÌ´Ù.

example 1)

<Server>
   <ContextManager></ContextManager>
</Server>

example 2)

<Server>
   <ContextManager></ContextManager>
   <ContextManager></ContextManager>
   <ContextManager></ContextManager>
</Server>

 <!ATTLIST Server
     adminPort NMTOKEN "-1"
     workDir CDATA "work">

ATTLIST ´Â ¼Ó¼ºÀ» ÀǹÌÇϸç Server ¿ä¼ÒÀÇ ¼Ó¼ºÀ» Á¤ÀÇÇÑ´Ù. ´ÙÀ½Àº ¿¹ÀÌ´Ù.

<Server adminPort="8808" workDir="workdirect" >
   <ContextManager></ContextManager>
</Server>

 <!ELEMENT ContextManager (Context+, Interceptor*, Connector+)>

À§ÀÇ ¿¹´Â ContextManager ¿ä¼ÒÀÇ ÇÏÀ§ ¿ä¼Ò¸¦ Á¤ÀÇ ÇÑ´Ù. Interceptor* ÀÇ *Àº 0°³ ÀÌ»óÀ» ÀǹÌÇϹǷΠInterceptor °¡ ¾ø¾îµµ µÇ°í Çϳª ÀÌ»ó À־ µÈ´Ù. ´ÙÀ½Àº ¿¹ÀÌ´Ù.

<Server>
   <ContextManager>
    <Context></Context>
    <Connector></Connector>
    <Connector></Connector>
   </ContextManager>
</Server>

 <!ATTLIST ContextManager
     port NMTOKEN "8080"
     hostName NMTOKEN ""
     inet NMTOKEN "">

À§ÀÇ ³»¿ëÀº ¿ä¼Ò ContextManager ÀÇ ¼Ó¼ºÀ» Á¤ÀÇ ÇÑ´Ù. NMTOKEN Àº ¹®ÀÚ¿­ÀÇ ÇüÀ¸·Î º¸¾Æµµ µÇ¸ç XML ÀÇ À̸§ ¼³Á¤¿¡ ´ëÇÑ Á¦ÇÑ¿¡ ¸Â¾Æ ¶³¾îÁ®¾ß ÇÑ´Ù. "8080", "" µîÀº °¢ ¼Ó»ó °ªÀÇ µðÆúÆ® °ªÀ¸·Î¼­ °ªÀ» ¼³Á¤ ÇÏÁö ¾ÊÀ» °æ¿ì¸¦ ´ëºñÇÑ °ÍÀÌ´Ù. ´ÙÀ½Àº »ç¿ë ¿¹ÀÌ´Ù.

<Server>
   <ContextManager port="8007"></ContextManager>
</Server>

 <!ELEMENT Context EMPTY>

Context ¿ä¼Ò¸¦ Á¤ÀÇ ÇÑ´Ù. °ªÀº ¾ø´Ù(EMPTY).

 <!ATTLIST Context
     path CDATA #REQUIRED
     docBase CDATA #REQUIRED
     defaultSessionTimeOut NMTOKEN "30"
     isWARExpanded (true | false) "true"
     isWARValidated (false | true) "false"
     isInvokerEnabled (true | false) "true"
     isWorkDirPersistent (false | true) "false">

Context¿ä¼ÒÀÇ ¼Ó¼ºÀ» Á¤ÀÇÇÑ´Ù. CDATA ´Â ¹®ÀÚ¿­À» ÀǹÌÇϸç #REQUIRED ´Â ¹«Á¶°Ç °ªÀÌ ÀÖ¾î¾ß µÊÀ» ÀǹÌÇϸç (true | false) ´Â true ³ª false Áß¿¡¼­ °ªÀÌ ³ª¿Í¾ß ÇÔÀ» ÀǹÌÇÑ´Ù. ±× ´ÙÀ½ÀÇ "true" ³ª "false"´Â µðÆúÆ® °ªÀÌ´Ù. ´ÙÀ½Àº »ç¿ë ¿¹ÀÌ´Ù.

<Server>
   <ContextManager>
    <Context path="/test" docBase="webapps/test"></Context>
   </ContextManager>
</Server>

 <!ELEMENT Interceptor EMPTY>

À§ÀÇ ³»¿ëÀº Interceptor ¿ä¼Ò¸¦ Á¤ÀÇÇÑ´Ù.

 <!ATTLIST Interceptor
     className NMTOKEN #REQUIRED
     docBase   CDATA #REQUIRED>

À§ÀÇ ³»¿ëÀº InterceptorÀÇ ¼Ó¼ºÀ» Á¤ÀÇÇÑ´Ù.

ÀÌÇÏ »ý·«

6. server.xml ¹× tomcat.conf ¼³Á¤ ¿¹

´ÙÀ½ÀÇ ¿¹Á¦´Â ¸ÞÀÏ ¹× °Ô½ÃÆÇÀ» ÅëÇØ µé¾î¿Â Áú¹®À» Á¤¸®ÇÑ °ÍÀÔ´Ï´Ù.

server.xml °ú tomcat.conf ÆÄÀÏÀº TOMCAT_HOME/conf µð·ºÅ丮¿¡ ÀÖ½À´Ï´Ù.

6.1 ¿¹Á¦ 1

***server.xml***

 <Context path="/pgsql" docBase="webapps/pgsql" debug="0" reloadable="true">
 </Context>

***tomcat.conf***

Alias /pgsql  /usr/local/tomcat/webapps/pgsql

<Directory "/usr/local/tomcat/webapps/pgsql">
   Options Indexes FollowSymLinks
</Directory>

ApJServMount /pgsql/servlet  /pgsql  (À̺κÐÀ» ÁÖÀÇ ±í°Ô º¸¼¼¿ä)

<Location /pgsql/WEB-INF/ >
   AllowOverride None
   deny from all
</Location>

/usr/local/tomcat/webapps/pgsql µð·ºÅ丮¿¡ WEB-INF/classes¸¦ ¸¸µé¾î Å×½ºÆ®¿ë À¥ ¾îÇø®ÄÉÀ̼ÇÀ» ÀúÀåÇÑ´Ù.

URL ½ÇÇà ¿¹ : http://www.xxx.com/pgsql/servlet/xxx

6.2 ¿¹Á¦ 2

***server.xml***


<Context path="/test" docBase="webapps/test" debug="0" reloadable="true">
</Context>

***tomcat.conf***

Alias  /test  /usr/local/tomcat/webapps/test

>Directory "/usr/local/tomcat/webapps/test">
 Options  Indexes  FollowSymLinks
>/Directory>

ApJServMount  /test  /test  (À̺κÐÀ» ÁÖÀÇ ±í°Ô º¸¼¼¿ä)

<Location /test/WEB-INF/ >
   AllowOverride  None
   deny  from  all
</Location>

URL ½ÇÇà ¿¹ : http://www.xxx.com/test/xxx

6.3 ¿¹Á¦ 3

1. ÀÏ´ÜÀº tomcatµð·ºÅ丮 ¹ØÀÇ confµð·ºÅ丮ÀÇserver.xmlÀ» ´ÙÀ½Ã³·³ ÆíÁýÇÕ´Ï´Ù. (´ëÃæ ³¡ ºÎºÐ¿¡ Ãß°¡ÇÏ¸é µÇ°ÚÁÒ.)

<Context path="/jj" docBase="/usr/local/apache/htdocs/jsp" debug="0" reloadable="true" > 
</Context>

2. ±×¸®°í µ¿ÀÏÇÑ µð·ºÅ丮ÀÇ tomcat.conf ÆÄÀÏ¿¡ ¾Æ·¡Ã³·³ Ãß°¡ÇØÁÖ°í¿ä.

Alias /jj /usr/local/apache/htdocs/jsp

<Directory "/usr/local/apache/htdocs/jsp">
   Options Indexes FollowSymLinks
</Directory>

ApJServMount /jj /jj

<Location /jsp/WEB-INF/ >
   AllowOverride None
   deny from all
</Location>

3. ±× ´ÙÀ½Àº /usr/local/apache/htdocs µð·ºÅ丮¿¡ jsp µð·ºÅ丮¸¦ ¸¸µé¸é µÇ°í¿ä. jsp ÀÌÇÏ µð·ºÅ丮´Â webapps µð·ºÅ丮¹ØÀÇ examples ¸¦ º¸°í ÂüÁ¶Çؼ­ µð·ºÅ丮¸¦ ±¸¼ºÇÏ¸é µÉ °Í °°³×¿ä.

Àú°°Àº °æ¿ì´Â Å×½ºÆ®¸¦ À§ÇØ examples µð·ºÅ丮¸¦ ¸ðµÎ º¹»çÇß°í¿ä. ±×Áß examples/jsp/dates/date.htmlÀ» Å×½ºÆ®Çغôµ¥ Àߵdz׿ä.

½ÇÇàÀº http://210.1x0.xx4.xx1/jj/jsp/dates/date.html·Î Çß½À´Ï´Ù.

7. Web Application,war,web.xml

ÀÌ ºÎºÐÀº Java Servlet Specification Version 2.2 ¸¦ ÂüÁ¶ÇÏ¿´´Ù. ÀÌ Àå¿¡ ¼Ò°³µÈ ³»¿ë¿Ü´Â ÀÌ ¹®¼­¸¦ ÂüÁ¶Çϱ⠹ٶõ´Ù.

Web Application À̶õ Servlet,JSP,HTML¹®¼­,±âŸ À̹ÌÁö³ª ¾ÐÃàµÈ ÀÚ·á ¹× ´Ù¸¥ µ¥ÀÌŸ¸¦ Æ÷ÇÔÇÏ´Â Web °ü·Ã ¸®¼Ò½ºÀÌ´Ù.

ÀÌ·¯ÇÑ Web Application À» ¾ÐÃàÇÏ¿© ¹èÆ÷Çϱâ À§ÇÑ ÆÄÀÏÀÌ WAR ÆÄÀÏÀÌ´Ù. WAR ÆÄÀÏÀº Web Application ArchiveÀÌ¸ç µð·ºÅ丮¸¦ Æ÷ÇÔÇÏ¿© ¾ÐÃà ȤÀº ÆÐÅ°ÁöµÈ ÇϳªÀÇ ÆÄÀÏÀÌ´Ù.

web.xmlÀº Deployment Descriptor À̸ç XML À» ¾Ë°í ÀÖ´Â ºÐÀº $TOMCAT_HOME/conf/web.dtd¸¦ º¸±â ¹Ù¶õ´Ù. web.xmlÀÇ ¿ä¼Ò´Â deployment Á¤º¸ ¹× ȯ°æ ¼³Á¤ µîÀÌ¸ç ´ÙÀ½°ú °°´Ù.

  • ServletContext Init Parameters
  • Session Configuration
  • Servlet/JSP Definitions
  • Servlet/JSP Mappings
  • Mime Type Mappings
  • Welcom File list
  • Error Pages
  • Security

web.xml ÆÄÀÏÀº $TOMCAT_HOME/webapps/user_app/WEB-INF µð·ºÅ丮¿¡ À§Ä¡Çϸç user_app µð·ºÅ丮 ÀÌÇÏ¿¡ ÀÖ´Â Web Application ÀÇ È¯°æ ¼³Á¤ ºÎºÐÀ» ´ã´ãÇÑ´Ù°í º¸¸é µÈ´Ù. Áï, ¸ðµç Web Application ÀÌ ¾Æ´Ñ ƯÁ¤ Web Application ¸¸ÀÇ È¯°æ ¼³Á¤¸¸À» Çϸç, WAR ÆÄÀÏ·Î ÆÐÅ°Áö µÉ ¶§ °°ÀÌ Æ÷ÇԵȴÙ.

WEB-INF µð·ºÅ丮¿¡´Â web.xml ÆÄÀÏ°ú classes µð·ºÅ丮 ±âŸ lib µð·ºÅ丮°¡ À§Ä¡ÇÑ´Ù. Âü°í·Î classes µð·ºÅ丮¿¡ servlet °ú utility class µîÀÌ À§Ä¡ ÇÒ ¼ö ÀÖ´Ù.

Âü°í·Î web.xmlÀº °¢°¢ÀÇ »ç¿ëÀÚ µð·ºÅ丮¸¦ ¸¸µç ÈÄ ÇØ´ç µð·ºÅ丮¿¡ ´ëÇÑ ÀûÀýÇÑ ¼³Á¤ ÈÄ $TOMCAT_HOME/conf/web.xml À» $TOMCAT_HOME/webapps/ÇØ´ç_µð·ºÅ丮/WEB-INF/¿¡ º¹»çÇÏ¿© »ç¿ëÇÑ´Ù. web.xml¼³Á¤Àº °¢ÀÚÀÇ web application ¿¡ ¸Â°Ô ¼³Á¤ÇÑ´Ù.

´ÙÀ½Àº web.dtd ¹× web.xmlÀÇ °£´ÜÇÑ ¼³¸í°ú ¿¹¸¦ º¸ÀÌ°Ú´Ù. ¶ÇÇÑ web.dtd ¹× web.xmlÀÇ ÀÌÇظ¦ µ½±â À§ÇØ xml ¿¡ ´ëÇÑ °£´ÜÇÑ ¼³¸íÀ» Çϵµ·Ï ÇÏ°Ú´Ù.

´ÙÀ½Àº $TOMCAT_HOME/conf/web.dtd ÀÇ ÀϺκÐÀÌ´Ù.

<!--(ÁÖ¼®) The session-timeout element defines the default session 
timeout interval for all sessions created in this web application. 
The specified timeout must be expressed in a whole number of minutes.-->
<!ELEMENT session-timeout (#PCDATA)>
<!ATTLIST session-timeout id ID #IMPLIED>
...........
...........
<!--(ÁÖ¼®) The welcome-file-list contains an ordered list of 
welcome files elements. -->
<!ELEMENT welcome-file-list (welcome-file+)>
<!ATTLIST welcome-file-list id ID #IMPLIED>
<!--(ÁÖ¼®) The welcome-file element contains file name to use 
as a default welcome file, such as index.html-->
<!ELEMENT welcome-file (#PCDATA)>
<!ATTLIST welcome-file id ID #IMPLIED>

À§ÀÇ <!ELEMENT session-timeout (#PCDATA)> session ÀÇ µðÆúÆ® Time-Out ½Ã°£À» ¼³Á¤Çϵµ·Ï ÇÏ´Â ¿ä¼Ò·Î¼­ ¿ä¼Ò Á¤ÀÇ ºÎºÐÀÌ´Ù. (#PCDATA)´Â ´Ü¸» ³ëµå¸¦ ÀǹÌÇÏ¸ç ½ºÆ®¸µÀÌ ¿À¸é µÈ´Ù. (Âü°í·Î xml Àº Æ®¸® ±¸Á¶ÀÌ´Ù.)

<!ATTLIST session-timeout id ID #IMPLIED> Àº session-timeout ¿ä¼Ò¿¡ ´ëÇÑ ¼Ó¼ºÀÇ Á¤ÀÇ ºÎºÐÀÌ´Ù. #IMPLIED´Â session-timeout ¿ä¼ÒÀÇ id °¡ »ý·«°¡´ÉÇÔÀ» ÀǹÌÇÑ´Ù. Áï, <session-timeout id="123dc56"> ó·³ µÇ¾î¾ß Çϳª #IMPLIED ·Î ÀÎÇØ <session-timeout> °¡ µÇ¾îµµ µÈ´Ù.

welcome-file Àº web-application ÀÇ welcome-fileÀ» Á¤ÀÇÇÏ¸ç ¾ÆÆÄÄ¡ÀÇ DocumentRootÀÇ index.html °ú °°´Ù°í º¸¸é µÈ´Ù. (welcome-file+) Àº welcome-file-list ¿ä¼ÒÀÇ Àڽijëµå¸¦ Á¤ÀÇ Çϸç "+" welcome-file ¿ä¼Ò°¡ Çϳª ÀÌ»ó À־ µÈ´Ù´Â ÀǹÌÀÌ´Ù. ¾Æ·¡ÀÇ web.xml ÀÇ ¿¹ÀÇ welcome-file-list ¿ä¼Ò³»ÀÇ welcome-file¿ä¼Òµéó·³ ´Ù¼ö°¡ ¿Ã ¼ö ÀÖ´Ù´Â ÀǹÌÀÌ´Ù.

´ÙÀ½Àº $TOMCAT_HOME/conf/web.xmlÀÇ ÀϺκÐÀÌ´Ù.

<session-timeout>
  30
</session-timeout>
..........
..........
<welcome-file-list>
<welcome-file>
   index.jsp
</welcome-file>
<welcome-file>
   index.html
</welcome-file>
<welcome-file>
   index.htm 
</welcome-file>
</welcome-file-list>

8. PostgreSQL ÀÇ JDBC ¿¡ ¿¬µ¿ ¹× ÇѱÛó¸®

8.1 PostgreSQL ÀÇ JDBC ¿¬µ¿

Tomcat 3.1 ¿¡ postgreSQLÀÇ JDBC ¿¬µ¿Àº ÀÇ¿Ü·Î °£´ÜÇÏ´Ù. ȯ°æº¯¼ö CLASSPATH ¿¡ µî·ÏÇϱ⸸ ÇÏ¸é µÈ´Ù. ±×·¯¸é Tomcat ½ÇÇà½Ã ÀÚµ¿À¸·Î Àо JDBC ¸¦ ·ÎµùÇÑ´Ù.

CLASSPATH ¼³Á¤ ¿¹

   export  CLASSPATH=$CLASSPATH:/usr/local/pgsql7.0.2/jdbc/postgresql.jar

8.2 Tomcat ¿¡¼­ÀÇ ÇÑ±Û Ã³¸®

Tomcat ¿¡¼­ÀÇ ÇѱÛ󸮴 Apache-Jserv ¿Í µ¿ÀÏÇÏ´Ù.

¾Æ·¡´Â °³·«ÀûÀÎ ¼Ò½ºÀÔ´Ï´Ù.

  ..............
  ..............

  public void doGet(HttpServletRequest req , HttpServletResponse res)
  throws ServletException,IOException 
  {
    .......
    .......
    PrintWriter out;
    res.setContentType("text/html;charset=euc-kr");
    out=new PrintWriter(new OutputStreamWriter(
                     res.getOutputStream(),"KSC5601")); 
    .......
    .......
 }
   .....
   .....
  public  void doPost(HttpServletRequest req, HttpServletResponse res)
  throws ServletException,IOException 
  {
    res.setContentType("text/html;charset=euc-kr");
    PrintWriter out=new PrintWriter(new OutputStreamWriter(
                                    res.getOutputStream(),"KSC5601"));
    ....
    String id=ksc(req.getParameter("id"));
    String name=ksc(req.getParameter("name"));
    String juso=ksc(req.getParameter("juso"));
    String tel=ksc(req.getParameter("tel"));
    String memo=ksc(req.getParameter("memo"));
    ....
    ....
  }
    .....
    .....

  public String ksc(String kscstr)
  throws UnsupportedEncodingException
  {
   if(kscstr==null) return null;
   return new String(kscstr.getBytes("8859_1"),"KSC5601");
  } //  ksc() ÇÔ¼ö´Â ¹®ÀÚ¸¦ KSC5601·Î º¯È¯ÇÑ´Ù.

  ............................................................

8.3 PostgreSQL 7.0.2's JDBC ¿¡¼­ÀÇ ÇѱÛó¸®

¶ÇÇÑ Æ÷½ºÆ®±×·¹½º7.0.2¿¡ ÇѱÛÀ» »ðÀÔÇϱâÀü¿¡ KSC5601·Î º¯È¯ÇÏ¿©¾ß ÇÑ´Ù. ±×·¸Áö ¾ÊÀ¸¸é Æ÷½ºÆ®±×·¹½º¿¡ µé¾î°£ ÇѱÛÀº ¹Ù·Î ±úÁø´Ù. ±âŸ ´Ù¸¥ ¹öÁ¯Àº ¾Æ¸¶ ºñ½ÁÇÒ °Å·Î ÃßÃøµÇ¸ç ¾ÆÁ÷ Å×½ºÆ®´Â ¸øÇØ º¸¾Ò´Ù.

¾Æ·¡Ã³·³ ¹®ÀÚ¸¦ ksc()ÇÔ¼ö·Î ksc5601 ·Î º¯È¯ÇÑ ÈÄ¿¡ Æ÷½ºÆ®±×·¹½º¿¡ insert ÇÏ¸é µÈ´Ù.

  String id=ksc(req.getParameter("id"));
  String name=ksc(req.getParameter("name"));
  String juso=ksc(req.getParameter("juso"));
  String tel=ksc(req.getParameter("tel"));
  String memo=ksc(req.getParameter("memo"));

9. cocoon 1.8

CocoonÀº official ¹öÁ¯°ú unofficial ¹öÁ¯À» »ç¿ëÇÏ¿© ¼³Ä¡¸¦ ÇÒ ¼ö°¡ ÀÖ´Ù. official¹öÁ¯Àº ±î´Ù·Î¿î ¼³Ä¡ ¹× ¼³Á¤À» ÇÇÇϱâ À§ÇØ ±¸¼ºµÈ ¹ÙÀ̳ʸ® ÆÐÅ°ÁöÀÌ¿©¼­ ´Ù¿î¹Þ¾Æ ¾ÐÃàÀ» Ç®°í Àڹ٠Ŭ·¡½º¸¸ ÇÊ¿äÇÑ °÷¿¡ º¹»ç¸¦ ÇÏ¸é µÈ´Ù. ¹Ý´ë·Î unofficialÀº ±×·¸Áö ¾Ê´Ù.

cocoon Àº XML ±â¹ÝÀÇ Web publishing À» Çϱâ À§ÇÑ 100% ¼ø¼ö ÀÚ¹Ù publishing FrameworkÀÌ´Ù. XMLÀ» ¿Ïº®ÇÏ°Ô Áö¿øÇÏÁö ¾Ê´Â ºê¶ó¿ìÁ®¸¦ À§ÇØ XML °ü·Ã ÆÄÀÏÀ» ¼­¹öÃø¿¡¼­ ó¸®ÇÏ¿© HTML ·Î º¯È¯ÇÏ¿© ±× °á°ú¸¦ »ç¿ëÀÚÃøÀÇ ºê¶ó¿ìÁ®¿¡ º¸¿©ÁØ´Ù.

Cocoon1.8 À» ´Ù¿î¹Þ±â¸¦ ±ÇÀåÇÏ¸ç ´Ù¿îÀº http://xml.apache.org ¿¡¼­ Çϱ⠹ٶõ´Ù.

¶ÇÇÑ ÀÌ ¹®¼­¿¡¼­´Â ¸®´ª½º ±â¹Ý¿¡¼­ Tomcat-apache °¡ ¼³Ä¡µÈ »óÅ¿¡¼­ Cocoon 1.8ÀÇ official ¹öÁ¯À» ±âÁØÀ¸·Î ¼³Ä¡ ¹æ¹ýÀ» ¼³¸íÇÑ´Ù.

±âŸ ÇÊÀÚ°¡ XML¿¡ °üÇØ ¹®¿ÜÇÑÀ̹ǷΠXML ÀÚü¿¡ ´ëÇÑ ¼³¸íÀº ºÒ°¡Çϸç Áú¹® ¶ÇÇÑ ´äº¯ÀÌ ºÒ°¡ÇÏ´Ï ÂüÁ¶Çϱ⠹ٶõ´Ù.

9.1 cocoon ¼³Ä¡

1. ´Ù¿î ¹ÞÀº Cocoon 1.8 ¹ÙÀ̳ʸ® ÆÐÅ°Áö¸¦ Àû´çÇÑ °÷¿¡¼­ ¾ÐÃàÀ» Ǭ´Ù.

2. Cocoon ÀÇ bin µð·ºÅ丮ÀÇ cocoon.jar °ú lib µð·ºÅ丮ÀÇ ¸ðµç *.jar ÆÄÀÏÀ» tomcat µð·ºÅ丮ÀÇ lib µð·ºÅ丮¿¡ º¹»çÇÑ´Ù.

3. tomcat µð·ºÅ丮¹ØÀÇ conf µð·ºÅ丮·Î À̵¿ÇÏ¿© server.xmlÀ» ÆíÁýÇÑ´Ù. ¾Æ·¡ÀÇ ¶óÀÎÀ» ÀûÀýÈ÷ Ãß°¡ÇÏ¸é µÈ´Ù.

<Context path="/cocoon" docBase="webapps/cocoon" debug="0" reloadable="true">
</Context>

4. tomcat µð·ºÅ丮¹ØÀÇ conf µð·ºÅ丮ÀÇ tomcat.conf¿¡ ´ÙÀ½ÀÇ ¿¹¸¦ Ãß°¡ÇÑ´Ù.

Alias /cocoon $TOMCAT_HOME/webapps/cocoon
<Directory "$TOMCAT_HOME/webapps/cocoon">
  Options Indexes FollowSymLinks
</Directory>
ApJServMount /cocoon /cocoon
<Location /cocoon/WEB-INF/ >
  AllowOverride None
  deny from all
</Location>

5. ¾Æ·¡ÀÇ ¿¹Ã³·³ tomcat µð·ºÅ丮ÀÇ webapps µð·ºÅ丮¿¡ µð·ºÅ丮¸¦ ¸¸µç´Ù.

mkdir $TOMCAT_HOME/webapps/cocoon
mkdir $TOMCAT_HOME/webapps/cocoon/WEB-INF 

6. ¾Æ·¡ÀÇ ¿¹Ã³·³ cocoon ¼Ò½º µð·ºÅ丮³»ÀÇ ÀÇ web.xml ÆÄÀÏ°ú cocoon.properties ÆÄÀÏÀ» Àû´çÈ÷ º¹»çÇÑ´Ù.

cp  cocoon_¼Ò½º_¾ÐÃàǬ_µð·ºÅ丮/src/WEB-INF/web.xml $TOMCAT_HOME/webapps/cocoon/WEB-INF
cp  cocoon_¼Ò½º_¾ÐÃàǬ_µð·ºÅ丮/conf/cocoon.properties $TOMCAT_HOME/webapps/cocoon/WEB-INF 

7. º¹»çµÈ web.xmlÀ» ¼öÁ¤ÇÑ´Ù.

<init-param>
...
<param-value>[path-to-cocoon]/conf/cocoon.properties</param-value>
... 
À§ÀÇ ºÎºÐ¿¡¼­ <param-value>[path-to-cocoon]/conf/cocoon.properties À» <param-value>/WEB-INF/cocoon.properties ·Î ¼öÁ¤ÇÑ´Ù.

8. ¸¶Áö¸·À¸·Î ¾Æ·¡ ¿¹Ã³·³ cocoon ¼Ò½º µð·ºÅ丮³»ÀÇ samples µð·ºÅ丮¸¦ tomcat µð·ºÅ丮¾Ö·Î º¹»çÇÑ´Ù.

cp  cocoon_¼Ò½º_¾ÐÃàǬ_µð·ºÅ丮/samples $TOMCAT_HOME/webapps/cocoon/servlets 

9.2 cocoon Å×½ºÆ®

cocoon ¿¡ ´ëÇÑ ¼³Ä¡ ¹× ¼³Á¤Àº ³¡³µ´Ù. °£´ÜÇÑ Å×½ºÆ®¸¦ À§ÇØ tomcat °ú apache¸¦ ±âµ¿ÇÑ ÈÄ ¾Æ·¡ÀÇ ¿¹Ã³·³ ºê¶ó¿ìÁ®¿¡ url À» ÀÔ·ÂÇÑ´Ù.

http://localhost/cocoon/Cocoon.xml
http://localhost/cocoon/servlets/index.xml 

Âü°í·Î Cocoon.xml Àº µð½ºÅ©»ó¿¡ Á¸ÀçÇÏ´Â ¹°¸®ÀûÀÎ ÆÄÀÏÀÌ ¾Æ´Ï¶ó ¼³Á¤¿¡ ÀÇÇØ Å×½ºÆ®¸¦ ¸ñÀûÀ¸·Î ÇÏ´Â °¡»óÆÄÀÏÀÌ´Ï Âü°íÇϱ⠹ٶõ´Ù.

Å×½ºÆ®°¡ ½ÇÆÐÇÒ °æ¿ì À§ÀÇ ¼ø¼­¸¦ ´Ù½Ã Çѹø È®ÀÎÇϱ⠹ٶó¸ç, ±âŸ, tomcat ±âµ¿½Ã tomcat ÀÇ lib µð·ºÅ丮¿¡ ÀÖ´Â xerces.jar ÀÇ Å¬·¡½º ·Îµå ¼ø¼­¸¦ xml.jar º¸´Ù ¸ÕÀú ·ÎµåÇϱâ À§ÇØ xml.jar À» zxml.jar ·Î rename Çϵµ·Ï ÇÏÀÚ.

´õ¿í ÀÚ¼¼ÇÑ ³»¿ëÀº http://xml.apache.org ¿¡¼­ ÂüÁ¶Çϱ⠹ٶõ´Ù.

10. Cocoon 1.8 ±âŸ»çÇ×

10.1 Cocoon 1.8 ÀÇ euc-kr Encoding

cocoon¿¡¼­ ÇѱÛÀ» º¸±â À§ÇØ $TOMCAT_HOME/webapps/cocoon/WEB-INF/cocoon.propertiesÀ» ¼öÁ¤ÇØ¾ß ÇÑ´Ù. vi ·Î cocoon.properties¸¦ ¿­°í XML Formatters ºÎºÐ¿¡ ÀÖ´Â HTML 4.0(strict) ºÎºÐÀ» ¼öÁ¤ÇÏ¸é µÈ´Ù. ´ÙÀ½Àº ¿¹ÀÌ´Ù.

# HTML 4.0 (strict)
formatter.text/html.doctype-public = ...
formatter.text/html.doctype-system = ...

À§ÀÇ ºÎºÐÀ» ã¾Æ¼­ ¾Æ·¡ÀÇ ¶óÀÎÀ» Ãß°¡ÇÏ¸é µÈ´Ù.

formatter.text/html.encoding = euc-kr

Áï, ´ÙÀ½Ã³·³ Ãß°¡ÇÏ¸é µÈ´Ù.

# HTML 4.0 (strict)
formatter.text/html.doctype-public = ...
formatter.text/html.doctype-system = ...
formatter.text/html.encoding = euc-kr

À§ÀÇ ÇÑ±Û ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ¾öû³­ »ðÁúÀ» Çß´Ù. ¾ÆÆÄÄ¡ µîÀÇ »çÀÌÆ®ÀÇ ¸ÞÀϸµ ¸®½ºÆ®µîÀ» ã¾Æº¸¸é formatter.text/html/loose ºÎºÐÀ» ¼öÁ¤Ç϶ó°í ³ª¿Í ÀÖ¾ú±â ¶§¹®Àε¥..

Ȥ½Ã À̺κп¡ ´ëÇØ ´Ù¸¥ ´ë¾ÈÀ̳ª ¹æ¹ýÀ» ¾Ë°í ÀÖ´Ù¸é ÇÊÀÚ (nogadax@kldp.org)¿¡°Ô ¸ÞÀÏÀ» º¸³»ÁÖ¾úÀ¸¸é ÇÑ´Ù.

10.2 °£´ÜÇÑ xml ¸¸µé±â

À̺ÐÀº ±×·¸°Ô ±ÇÀåÇÒ ¸¸ÇÑ ºÎºÐÀÌ ¾Æ´Ï´Ù. ÇÊÀÚ°¡ ¸¸µç °£´ÜÇÑ ¿¹Á¦°¡ ÀÖ¾î ±×³É ¿Ã·Á ³õÀº °ÍÀ̹ǷΠ°ü½ÉÀÖ´Â ºÐ¸¸ ÂüÁ¶Çϱ⠹ٶõ´Ù.

¾Æ·¡ÀÇ ¿¹Á¦¸¦ Å×½ºÆ®Çϱâ À§ÇØ $TOMCAT_HOME/webapps/cocoon/servlets/ngd µð·ºÅ丮¸¦ ¸¸µé¾ú´Ù. Å×½ºÆ®¸¦ ¸ñÀûÀ¸·Î ÀÛ¼ºÇÑ ÆÄÀÏÀº µÎ°³À̸ç ngd-book.xml °ú ngd-book.xsl ÀÌ´Ù. ngd-book.xmlÀº °£´ÜÇÑ xml ÆÄÀÏÀ̸ç ngd-book.xsl ÆÄÀÏÀº xml ¹®¼­¸¦ ºê¶ó¿ìÁ®¿¡ µð½ºÇ÷¹ÀÌÇϱâ À§ÇÑ ÆÄÀÏÀÌ´Ù.

Å×½ºÆ®¸¦ À§ÇÑ URLÀº http://210.110.1xx.xx6/cocoon/servlets/ngd/ngd-book.xml ÀÌ´Ù.

´ÙÀ½Àº °£´ÜÇÑ ¿¹Á¦ÀÌ´Ù.


<?xml version="1.0" encoding="euc-kr"?>
<?xml-stylesheet href="ngd-book.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<!DOCTYPE ngd-book [
 <!ELEMENT ngd-book (title?, name, dt, abstract, sect1)>
 <!ELEMENT title (#PCDATA)>
 <!ELEMENT name (#PCDATA)>
 <!ELEMENT dt (#PCDATA)>
 <!ELEMENT abstract (#PCDATA)>
 <!ELEMENT sect1 (#PCDATA)>
]>

<ngd-book>
 <title>Hello</title>
 <name>nogadax</name>
 <dt>/2000/11/11</dt>
 <abstract>TomcatÀº The Jakarta ProjectÀÇ »ê¹°À̸ç ȨÆäÀÌÁö´Â 
 http://jakarata.apache.org ÀÌ´Ù. Jakarta ProjectÀÇ ¸ñÇ¥´Â 
 ¿ÀÇ ¼Ò½ºÈ­µÇ¾î °³¹ßµÈ Java Ç÷§ÆûÀ» ±â¹ÝÀ¸·Î ÇÏ¿© »ó¿ë Ç°ÁúÀÇ 
 ¼­¹ö ¼Ö·ç¼ÇÀ» Á¦°øÇϱâ À§ÇÔÀÌ´Ù. ±âŸ XML °ü·Ã ÆÐÅ°ÁöÀÎ 
 cocoon ÀÇ È¨ ÆäÀÌÁö´Â http://xml.apache.orgÀÌ´Ù. CocoonÀº 
 XML ÆÄÀÏÀ» ¼­¹öÃø¿¡¼­ ó¸®ÇÏ¿© À̸¦ ºê¶ó¿ìÁ®¿¡ º¸¿©ÁÖ´Â
 ÆÐÅ°Áö·Î ¼­¤©Ä¡°¡ °£ÆíÇÏ´Ù.
 </abstract>
 <sect1>
 TomcatÀº The Jakarta ProjectÀÇ »ê¹°À̸ç ȨÆäÀÌÁö´Â 
 http://jakarata.apache.org ÀÌ´Ù. Jakarta ProjectÀÇ ¸ñÇ¥´Â 
 ¿ÀÇ ¼Ò½ºÈ­µÇ¾î °³¹ßµÈ Java Ç÷§ÆûÀ» ±â¹ÝÀ¸·Î ÇÏ¿© »ó¿ë Ç°ÁúÀÇ 
 ¼­¹ö ¼Ö·ç¼ÇÀ» Á¦°øÇϱâ À§ÇÔÀÌ´Ù. ±âŸ XML °ü·Ã ÆÐÅ°ÁöÀÎ 
 cocoon ÀÇ È¨ ÆäÀÌÁö´Â http://xml.apache.orgÀÌ´Ù. CocoonÀº XML 
 ÆÄÀÏÀ» ¼­¹öÃø¿¡¼­ ó¸®ÇÏ¿© À̸¦ ºê¶ó¿ìÁ®¿¡ º¸¿©ÁÖ´Â
 ÆÐÅ°Áö·Î ¼­¤©Ä¡°¡ °£ÆíÇÏ´Ù.
 </sect1>
</ngd-book>

<?xml version="1.0" encoding="euc-kr"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="ngd-book">
   <xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
   <html>
    <head>
     <title>
      <xsl:value-of select="title"/>
     </title>
    </head>
    <body bgcolor="#ffffff">
      <xsl:apply-templates/>
    </body>
   </html>
  </xsl:template>

  <xsl:template match="title">
   <h2>
    <xsl:apply-templates/>
   </h2>
  </xsl:template>

  <xsl:template match="name">
    <h3>
      <xsl:apply-templates/>
    </h3>
  </xsl:template>

  <xsl:template match="dt">
    <h4>
      <xsl:apply-templates/>
    </h4>
  </xsl:template>
  <xsl:template match="abstract">
    <hr/>
    <p>
    <i>
      <xsl:apply-templates/>
    </i>
    </p>
    <hr/>
  </xsl:template>
  <xsl:template match="sect1">
    <p>
      <xsl:apply-templates/>
    </p>
  </xsl:template>

</xsl:stylesheet>

11. Tomcat 3.2.1 ¼³Ä¡

Tomcat 3.2 ¹öÁ¯Àº Å©°Ô µÎ°¡Áö ¹æ¹ýÀ¸·Î ¼³Ä¡µÉ ¼ö ÀÖ´Ù. mod_jserv ¸¦ ÀÌ¿ëÇÑ ¼³Ä¡¿Í mod_jk ¸¦ ÀÌ¿ëÇÑ ¼³Ä¡°¡ ÀÖ´Ù. µÎ°¡Áö ¸ðµÎ Çã¿ëµÈ ¼³Ä¡´Â ºÒ°¡ÇÏ¸ç °¢°¢ µû·Î ¼³Ä¡µÇ¾î¾ß ÇÑ´Ù.

11.1 Tomcat 3.2.1(mod_jserv,Ajpv12)

A. ¼³Ä¡ ȯ°æ ¹× ÁÖÀÇ »çÇ×

 - wow linux 6.2 
 - Tomcat 3.2.1 
 - Apache 1.3.14
 - JDK 1.2.2 
 - ¾Æ·¡´Â ÁÖÀÇ »çÇ×ÀÌ´Ù. 
   a. Apache ¿Í JDK ´Â ¸ÕÀú ¼³Ä¡µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù.
   b. ¾Æ·¡ÀÇ ¼³Ä¡´Â mod_jserv¿¡ ÀÇÇÑ ¼³Ä¡ÀÌ´Ù.
   c. ÅèĹ 3.2 ¹öÁ¯´ë¿Í 3.1¹öÁ¯´ëÀÇ ¼³Ä¡°¡ ´Ù¸¦ ¼ö ÀÖ´Ù.
   d. ¶ÇÇÑ ¸±¸®ÁîµÉ ÅèĹ 4.0 ¹öÁ¯°úÀÇ ¼³Ä¡°¡ ´Ù¸¦ ¼ö ÀÖ´Ù.
   

B. ¼³Ä¡


B-1 

 -Tomcat 3.2.1 ÀÇ ¹ÙÀ̳ʸ® ¹öÁ¯°ú ¼Ò½º ¹öÁ¯ ¸ðµÎ ´Ù¿ò ¹Þ´Â´Ù. 
 -http://jakarta.apache.org ¿¡¼­ ´Ù¿î¹Þ´Â´Ù. 

B-2
 
 -ÅèĹ ¹ÙÀ̳ʸ® ¹öÁ¯Àº /usr/local ¿¡ ..
 -¼Ò½º ¹öÁ¯Àº /usr/local/src µð·ºÅ丮¿¡ ¾ÐÃàÀ» Ǭ´Ù. 
 -jakarata-tomcat-3.2.1.tar.gz ÀÇ °æ¿ì´Â ¾Æ·¡Ã³·³ ..
 - "tar -zxvf jakarta-tomcat-3.2.1.tar.gz"ÇÏ¿© ¾ÐÃà ÇØÁ¦ 

B-3

 -/usr/local/src/jakarta-tomcat-3.2.1-src/src/native/apache/jserv·Î À̵¿ 
 - "apxs -c -o mod_jserv.so *.c" ÇÏ¿© mod_jserv.so »ý¼º.
  
B-4

 -»ý¼ºµÈ mod_jserv.so¸¦ APACHE_HOME/libexec ·Î copy ÇÑ´Ù. 
 -ÁÖÀÇ : "APACHE_HOME" Àº ¼³Ä¡µÈ ¾ÆÆÄÄ¡ µð·ºÅ丮ÀÓ

B-5

 -APACHE_HOME/conf/httpd.conf ÆÄÀÏÀÇ ¸¶Áö¸· ¶óÀο¡ ´ÙÀ½ ¶óÀÎ Ãß°¡ 
 - Include /usr/local/jakarata-tomcat/conf/tomcat.conf 

B-6

 -/etc/profile ¿¡ JAVA_HOME ¹× TOMCAT_HOME ȯ°æ º¯¼ö ¼³Á¤. 
 -Tomcat ÀÇ bin µµ ȯ°æ º¯¼ö PATH ¿¡ µî·ÏÇÔ.
 -´ÙÀ½Àº ¼³Á¤ ¿¹ÀÌ´Ù. 
 - JAVA_HOME=/usr/local/jdk
 - TOMCAT_HOME=/usr/local/tomcat 
 - PATH=$PATH:/usr/local/tomcat/bin
 - export JAVA_HOME TOMCAT_HOME PATH
 
B-7

 -/etc/profile À» Àç½ÇÇØÇÏ´øÁö (¿¹: . /etc/profile)
 -·Î±×¾Æ¿ô ÈÄ ´Ù½Ã ·Î±×ÀÎ 

B-8

 -tomcat.sh start ÇÏ¿© ÅèÄ´À» ±âµ¿ÇÑ´Ù. 
 -¾ÆÆÄÄ¡º¸´Ù ¸ÕÀú ÅèĹÀÌ ±âµ¿ÇÏ¿© ÇÔ. 
B-9
 
 -TOMCAT_HOME/conf/tomcat.conf¸¦ ´Ù¸¥ À̸§À¸·Î ÀûÀýÈ÷ ¹é¾÷ ȤÀº copy
 -TOMCAT_HOME/conf/tomcat-apache.conf ¸¦ tomcat.conf·Î copy ÇÑ´Ù. 

B-10

 - apachectl start ÇÏ¿© ¾ÆÆÄÄ¡¸¦ ±âµ¿ÇÑ´Ù.
 -¾ÆÆÄÄ¡°¡ ±âµ¿Çϸ鼭 httpd.confÀÇ ¸¶Áö¸· ¶óÀÎÀ» Àаí tomcat.conf¸¦ 
  ÂüÁ¶ÇÏ°Ô µÈ´Ù. 
 -¾ÆÆÄÄ¡ ±âµ¿ ÈÄ ºê¶ó¿ìÁ®¸¦ ¶Ù¿ì°í ´ÙÀ½À» Å×½ºÆ®ÇÑ´Ù. 
 - http://MY-URL/examples/jsp
 - http://MY-URL/examples/servlets

11.2 tomcat.conf ¿¹Á¦ (Tomcat 3.2.1)

TOMCAT_HOME/conf ¿¡ Á¸ÀçÇÏ´Â tomcat.conf ¿Í ÅèĹÀÌ ±âµ¿ÇÒ ¶§ ÀÚµ¿ÀûÀ¸·Î »ý¼ºµÇ´Â tomcat-apache.conf´Â ÇÔ²² µ¿ÀÛÇÏ´Â ¾ÆÆÄÄ¡ ¹× ÅèĹ¿¡ ´ëÇÑ È¯°æ ¼³Á¤ ºÎºÐÀ» ´ã´ãÇÑ´Ù.

±âº»ÀûÀ¸·Î jserv ¿¡ ´ëÇÑ È¯°æ ¼³Á¤ Áö½Ã¾î°¡ »ç¿ëµÇ¹Ç·Î web-server-plugin Áß¿¡ mod_jserv ¸¸À» Çã¿ëÇÏ¸ç µðÆúÆ® ÇÁ·ÎÅäÄݷδ Ajpv12 ¸¦ »ç¿ëÇÏ¸ç µðÆúÆ® Æ÷Æ®·Î´Â 8007À» »ç¿ëÇÑ´Ù.

Tomcat ±âµ¿½Ã overwrite µÇ¾î ÀÚµ¿ »ý¼ºµÇ´Â tomcat-apache.conf´Â Ä¿½ºÅ͸¶ÀÌ¡¿¡ ºÎÀûÀýÇϹǷΠ»ý¼ºµÈ tomcat-apache.conf¸¦ tomcat.conf·Î º¹»çÇÏ¿© tomcat.conf¸¦ °è¼Ó ¼öÁ¤ÇÏ¸ç »ç¿ëÇÏ´Â °ÍÀÌ ÁÁÀ» µí ÇÏ´Ù. ÇÏÁö¸¸ tomcat-apache.conf¸¦ »ç¿ëÇÏ¿©µµ Å« ¹®Á¦´Â ¾øÀ» µí ...


################################################
#                                              #
#  TOMCAT_HOME/conf/tomcat.conf (2001,01,08)   #
#                                              #
################################################

#tomcat.conf ÆÄÀÏÀº ¾ÆÆÄÄ¡ÀÇ httpd.conf¿¡ ¼³Á¤¿¡ 
#ÀÇÇØ ¾ÆÆÄÄ¡¿¡ ÀÇÇØ ÀÐÇôÁü.
#¾ÆÆÄÄ¡°¡ mod_jserv¸¦ ÀνÄÇϵµ·Ï..
LoadModule jserv_module libexec/mod_jserv.so 

#mod_jserv ¸ðµâ¿¡ ´ëÇÑ ¼³Á¤»çÇ× 
<IfModule mod_jserv.c>

#mod_jserv ¼³Á¤»çÇ× 
############################
# Do not Edit!
############################
#¾ÆÆÄÄ¡°¡ ÅèĹÀ» ÀÚµ¿ ½ÇÇà ¸øÇϹǷΠmanual onÀ¸·Î 
ApJServManual on

#¾ÆÆÄÄ¡¿Í ÅèĹ°£ Åë½Å¿¡ ¾²ÀÏ µðÆúÆ® ÇÁ·ÎÅäÄÝ ¼³Á¤(ajpv12)
ApJServDefaultProtocol ajpv12

#mod_jserv ´Â º¸¾ÈÅ° Áö¿ø¾ÈµÊ DISABLED ·Î ..
ApJServSecretKey DISABLED

#°¡»ó È£½ºÆà ¸¶¿îÆ® Áö¿ø 
ApJServMountCopy on

#Log Level (´Ù¸¥ ·¹º§ : emerg,warn,crit,debug,,)
ApJServLogLevel notice
############################

#µðÆúƮȣ½ºÆ® ¹× Æ÷Æ® ¼³Á¤ 
#¾ÆÆÄÄ¡¿Í µ¿ÀÏÇÑ È£½ºÆ®(The same machine)À̸é localhost
ApJServDefaultHost localhost

#¾ÆÆÄÄ¡¿Í ÅèĹÀÌ Åë½ÅÇÒ µðÆúÆ® Æ÷Æ® ¼³Á¤ 
ApJServDefaultPort 8007

#¾ÆÆÄÄ¡¿¡°Ô jsp È®ÀåÀÚ¸¦ ÀνĽÃÅ°°í ..
AddType test/jsp .jsp

#jsp È®ÀåÀÚ¿¡ ´ëÇÑ Ã³¸®´Â ÅèĹÀ¸·Î ..
AddHandler jserv-servlet .jsp

#Alias ´Â ¾ÆÆÄÄ¡°¡ »ç¿ëÇÒ °¡»ó µð·ºÅ丮 Á¤ÀÇ .
#Static file(HTML,Image ÆÄÀÏ)Àº ¾ÆÆÄÄ¡°¡ ó¸®Çϵµ·Ï ¼³Á¤.
#http://MY-URL/examples´Â ÅèĹÀÌ ¾Æ´Ñ ¾ÆÆÄÄ¡°¡ ó¸® 
Alias /examples "/usr/local/tomcat/webapps/examples"

#¾ÆÆÄÄ¡°¡ ó¸®ÇÒ °¡»ó µð·ºÅ丮ÀÇ ½ÇÁ¦ µð·ºÅ丮¿¡ ´ëÇÑ ¼³Á¤»çÇ×
<Directory "/usr/local/tomcat/webapps/examples">
 Options Indexes FollowSymLinks
</Directory>

#ÅèĹÀÌ »ç¿ëÇÒ URL-PATH¸¦ À§ÇÑ ¸¶¿îÆà ¼³Á¤ ¿É¼Ç 
#http://MY-URL/examples/servlet/my_classes
#¶ÇÇÑ ¾Æ·¡ÀÇ ¸¶¿îÆ®¿É¼Ç°ú ´ÙÀºÀº µî°¡ÀÏ °ÍÀÌ´Ù. 
#ApJServMount /examples/servlet ajpv12://localhost:8007/examples
ApJServMount /examples/servlet /examples

#º¸¾È»ó Áß¿äÇÑ WEB-INF µð·ºÅ丮¿¡ ´ëÇÑ º¸È£ ¼³Á¤ 
#¸¶Âù°¡Áö·Î META-INFµµ ¶È°°ÀÌ ¼³Á¤Çϸé ÁÁÀ»µí..
<Location "/examples/WEB-INF/">
 AllowOverride None
 deny from all
</Location>

..........
..........
</IfModule>
</verb></tscreen>

11.3 Tomcat 3.2.1 (mod_jk.so, Ajp13)

mod_jk.so´Â mod_jserv.so ¸¦ ¿ÏÀüÈ÷ ÀçÀÛ¼ºÇÑ web-server-pluginÀÌ´Ù. web-server-pluginÀ̶õ ¾ÆÆÄÄ¡µîÀÇ À¥¼­¹ö¿Í ÅèĹ»çÀÌÀÇ Åë½ÅÀ» ´ç´ãÇÏ´Â ¸ðµâ·Î¼­ Á¦°øµÈ Æ÷Æ®¿Í ƯÁ¤ ÇÁ·ÎÅäÄÝÀ» ÀÌ¿ëÇÏ¿© À¥¼­¹ö¿Í ÅèĹ°£ Åë½ÅÀ» Áö¿øÇÑ´Ù.

À¥ ºê¶ó¿ìÁ®¸¦ ÅëÇØ ¾ÆÆÄÄ¡ ¼­¹öµîÀÇ À¥¼­¹ö·Î Àü´ÞµÈ Ŭ¶óÀ̾ðÆ®ÃøÀÇ »ç¿ëÀÚ ¿äûÀº ÅèĹÀ¸·Î Àü´ÞµÉ ¼ö ÀÖÀ¸¸ç ÅèĹ¿¡¼­ ó¸®µÈ °á°ú¸¦ ¾ÆÆÄÄ¡ ¼­¹ö·Î Àü´ÞÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù.

À¥¼­¹ö¿Í ÅèĹ»çÀÌ¿¡¼­ÀÇ Åë½ÅÀ» À§ÇØ ¿ä±¸µÇ´Â °ÍÀº Æ÷Æ®¹øÈ£¿Í ÇÁ·ÎÅäÄÝ ¹× ±âŸ È£½ºÆ®¿¡ ´ëÇÑ Á¤º¸µîÀÌ´Ù. È£½ºÆ®¿¡ ´ëÇÑ °ÍÀº À§ÀÇ tomcat.confÀÇ ApJServDefaultHost¸¦ º¸¶ó.

mod_jk¿¡¼­ »ç¿ëÇÏ´Â ÇÁ·ÎÅäÄݷδ ũ°Ô µÎ°¡Áö°¡ ÀÖÀ¸¸ç Ajpv12 ¿Í Ajpv13 ÀÌ ÀÖ´Ù.

A. ¼³Ä¡È¯°æ ¹× ÁÖÀÇ»çÇ×

 - wow linux 6.2 
 - Tomcat 3.2.1 
 - Apache 1.3.14
 - JDK 1.2.2 
 - ´ÙÀ½Àº ÁÖÀÇ»çÇ×ÀÌ´Ù. 
   a. Apache ¿Í JDK ´Â ¸ÕÀú ¼³Ä¡µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù.
   b. ¾Æ·¡ÀÇ ¼³Ä¡´Â mod_jk¿¡ ÀÇÇÑ ¼³Ä¡ÀÌ´Ù.
   c. ÅèĹ 3.2 ¹öÁ¯´ë¿Í 3.1¹öÁ¯´ëÀÇ ¼³Ä¡°¡ ´Ù¸¦ ¼ö ÀÖ´Ù.
   d. ¶ÇÇÑ ¸±¸®ÁîµÉ ÅèĹ 4.0 ¹öÁ¯°úÀÇ ¼³Ä¡°¡ ´Ù¸¦ ¼ö ÀÖ´Ù.

B. ¼³Ä¡

B-1
 
 -ÅèĹ 3.2.1 ¹ÙÀ̳ʸ® ¹öÁ¯°ú ¼Ò½º ¹öÁ¯ ¸ðµÎ ´Ù¿î¹Þ´Â´Ù.  
 -http://jakarta.apache.org ¿¡¼­ ´Ù¿î¹Þ´Â´Ù. 

B-2 
 
 -ÀÌÀü¿¡ ÅèĹÀ» mod_jserv·Î ¼³Ä¡Çß´Ù¸é 
 -mod_jserv¿¡ ´ëÇÑ ¸ðµç »çÇ×Àº ¸ðµÎ »èÁ¦ 
 -httpd.conf ÀÇ Include /usr/local/tomcat/conf/tomcat.confµîÀÇ Ç× Á¦°Å  
 
B-3 

 -ÅèĹ ¹ÙÀ̳ʸ® ¹öÁ¯Àº /usr/local/ ¿¡ 
 -¼Ò½º ¹öÁ¯Àº /usr/local/src/ ¿¡ ¾ÐÃàÀ» Ǭ´Ù. 
 -jakarata-tomcat-3.2.1.tar.gz ÀÇ °æ¿ì´Â ¾Æ·¡Ã³·³ .. 
 -"tar -zxvf jakarta-tomcat-3.2.1.tar.gz"ÇÏ¿© ¾ÐÃà ÇØÁ¦ 
 
B-4 
 
 -mod_jk.so ¸¦ »ý¼ºÇϱâ À§ÇØ ´ÙÀ½Ã³·³  ¼Ò½º µð·ºÅ丮·Î À̵¿. 
 -"cd /usr/local/src/jakarta-tomcat-3.2.1-src/src/native/apache1.3" 
   (or apache2.0)
 -"apxs -o mod_jk.so -I../jk -I/usr/local/jdk/include 
   -I/usr/local/jdk/include/linux -c *.c ../jk/*.c" 
 -À§ÀÇ ¶óÀÎÀ» ¸ðµÎ ÇÑÁÙ¿¡¼­ ÀÔ·Â ÈÄ ½ÇÇà. 
 -JDK PATH ´Â ÀÚ½ÅÀÇ JDK °æ·Î¿¡ ¸Â°Ô..
 -»ý¼ºµÈ mod_jk.so ¸¦ APACHE_HOME/libexec/¿¡ copy ÇÑ´Ù. 
 -APACHE_HOME ÀÚ½ÅÀÇ ¾ÆÆÄÄ¡ µð·ºÅ丮 °æ·ÎÀÓ.
 
B-5 
 
 -/etc/profile¿¡ TOMCAT_HOME °ú JAVA_HOME ¹× ÅèĹÀÇ bin °æ·Î ¼³Á¤ 
 -´ÙÀ½Àº ¼³Á¤ ¿¹ÀÌ´Ù. 
 - JAVA_HOME=/usr/local/jdk
 - TOMCAT_HOME=/usr/local/tomcat 
 - PATH=$PATH:/usr/local/tomcat/bin
 - export JAVA_HOME TOMCAT_HOME PATH

B-6 

 -/etc/profile À» Àç½ÇÇØÇÏ´øÁö (¿¹: . /etc/profile)
 -·Î±×¾Æ¿ô ÈÄ ´Ù½Ã ·Î±×ÀÎ 

B-7

 -Ajpv13 ¼³Á¤ 
 -TOMCAT_HOME/conf/server.xml ¿¡ ´ÙÀ½ ³»¿ëÀ» Ajp12 ¼³Á¤ ´ÙÀ½ ºÎºÐ¿¡ Ãß°¡ 
 -<Connector className="org.apache.tomcat.service.PoolTcpConnector">
    <Parameter name="handler"
    value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
    <Parameter name="port" value="8009">
  </Connector>
 -Âü°í·Î Ajpv12 ¿¡ ´ëÇÑ ¼³Á¤ ºÎºÐÀº ±×´ë·Î ³ªµÐ´Ù. 
 -Ajpv12 ¼³Á¤ ºÎºÐÀº ÅèĹÀÇ Á¾·á¿¡ ´ëÇÑ ºÎºÐÀ» °ü¿©Çϱ⠶§¹®ÀÌ´Ù. 
 -´ë½Å stand-alone ¸ðµå°¡ ¾Æ´Ï¹Ç·Î http ¿¡ ´ëÇÑ ºÎºÐÀº ÁÖ¼®Ã³¸® °¡´ÉÇÏ´Ù. 
 
B-8 

 -¾ÆÆÄÄ¡ÀÇ httpd.conf¿¡ ´ÙÀ½¶óÀÎ Ãß°¡ 
 -Include /usr/local/jakarta-tomcat/conf/mod_jk.conf-auto
 
B-9 

 -TOMCAT_HOME/conf/workers.properties ¼öÁ¤Çϱâ 
 -¼öÁ¤µÇ¾îÁú Ç׸ñÀº ´ÙÀ½ÀÇ 3°³ÀÌ´Ù.
 -workers.tomcat_home, workers.java_home, ps
 -workers.tomcat_home À» ´ÙÀ½Ã³·³ 
 -workers.tomcat_home=/usr/local/jakarta_tomcat
 -workers.java_homeÀ» ´ÙÀ½Ã³·³ 
 -workers.java_home-/usr/local/jdk
 -ps ¸¦ ´ÙÀ½Ã³·³ 
 -ps=/
 -°¢°¢ À§ÀÇ ¿¹¸¦ º¸¸ç Àڽſ¡ ¸Â°Ô ÀûÀýÈ÷ ¼öÁ¤ÇÑ´Ù. 
 
 
B-10 

 -½ÇÇà ÈÄ È®ÀÎÇÑ´Ù. 
 -tomcat.sh start
 -apachectl start 
 -ºê¶ó¿ìÁ®¸¦ ¶Ù¿ì°í URL â¿¡ ´ÙÀ½Ã³·³ ÀÔ·Â 
 -http://MY-URL/examples/jsp

11.4 stand-alone Á¦°Å

server.xml ÆÄÀÏÀ» ¼öÁ¤ÇÏ¿© stand-alone µ¿ÀÛÀ» À§ÇÑ connector ºÎºÐÀº ÁÖ¼® ó¸®Çϰųª »èÁ¦ÇÏ¿©µµ ¹«¹æÇÏ´Ù. ¾Æ´Ï »èÁ¦ÇÏ´Â °ÍÀÌ ´õ ÁÁÀ» µíÇÏ´Ù. ÇÏÁö¸¸ AJPV13 À» »ç¿ëÇÏ´õ¶óµµ AJPV12 ¿¡ ´ëÇÑ Connector ¼³Á¤ºÎºÐÀº »èÁ¦¸¦ ÇÏ¸é ¾ÈµÈ´Ù. Ajpv12 Connector ºÎºÐÀº Tomcat ÀÇ Shutdown ¿¡ °ü¿©Çϱ⠶§¹®ÀÌ´Ù.

´ÙÀ½Àº server.xml ³»ÀÇ stand-alone ÀÇ operationÀ» À§ÇÑ HTTP Connection ¼³Á¤ºÎºÐÀÌ´Ù. ±×³É Âü°íÇϱ⠹ٶõ´Ù.

<Connector className="org.apache.tomcat.service.PoolTcpConnector">
 <Parameter name="handler"
   value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
 <Parameter name="port"
   value="8080"/>
</Connector>

12. Thread Pool Áö¿ø (Tomcat3.2.1)

12.1 Thread »ý¼ºÀ¸·Î ÀÎÇÑ ¹®Á¦Á¡

Tomact Àº multi-thread µÈ servlet container·Î¼­ À̴ Ŭ¶óÀ̾ðÆ®ÃøÀÇ °¢°¢ÀÇ ¿äûÀÌ ¾²·¹µå¿¡ ÀÇÇØ ½ÇÇàµÊÀ» ÀǹÌÇÑ´Ù. Tomcat 3.2 ÀÌÀü ¹öÁ¯¿¡¼­´Â Ŭ¶óÀ̾ðÆ®ÃøÀÇ °¢ ¿äûÀÌ µµÂøÇÒ ¶§¸¶´Ù, ¾²·¹µå°¡ »ý¼ºµÇ¾î °¢ ¿äûÀ» ó¸®ÇÏ°ï ÇÏ¿´´Ù. ÀÌ·¯ÇÑ ÀýÂ÷´Â ¸¹Àº ºÎÇϸ¦ ÀÏÀ¸Å°´Â ¹®Á¦¸¦ ¾ß±âÇϸç, ÀÌ·¯ÇÑ ¹®Á¦µéÀº ´ÙÀ½°ú °°´Ù.

* ¸ðµç ¿äû¿¡ ´ëÇØ ¾²·¹µå¸¦ »ý¼ºÇÏ°í ¼Ò¸êÇÏ´Â °ÍÀº OS¿Í JVM¿¡°Ô ÇÊ¿ä¾ø´Â ¸¹Àº ºÎ´ãÀ» ¾È°ÜÁØ´Ù.

* µ¿½Ã¿¡ ÀÏÁ¤ ÀÌ»óÀÇ ´Ù¼öÀÇ ¿äûÀÌ µé¾î¿Ã °æ¿ì ¸®¼Ò½º(CPU ¹× ¸Þ¸ð¸® ÀÚ¿øµî ) ¼Ò¸ð¿¡ ´ëÇÑ Á¦ÇÑÀÌ ¾î·Æ´Ù. Áï, ¼ø°£ÀûÀ¸·Î ¼­¹ö°¡ ´Ù¿îµÇ°Å³ª ±âŸ µ¿½Ã ´Ù¹ßÀûÀÎ ¿äûÀ» 󸮸øÇØ »ý±â´Â ¹®Á¦°¡ ¾ß±âµÉ ¼ö ÀÖ´Ù.

12.2 ¹®Á¦¿¡ ´ëÇÑ ÇØ°áÃ¥

ÀÌ·¯ÇÑ ¹®Á¦¿¡ ´ëÇÑ ÇØ°áÃ¥À¸·Î´Â Thread PoolÀ» »ç¿ëÇÏ´Â °ÍÀ̸ç Tomcat3.2 ºÎÅÍ´Â µðÆúÆ®·ÎÅèĹ ÀÚü¿¡¼­ Thread Pool À» »ç¿ëÇÑ´Ù. ´ÙÀ½Àº ÅèĹÀÇ Thread Pool ¿¡ ´ëÇÑ ¼³¸íÀÌ´Ù.

a. °¢ ¿äû¿¡ ´ëÇØ ¾²·¹µå¸¦ »ý¼ºÇÏ¿© »ç¿ëÇÏ°í ³­ ÈÄ °è¼ÓÇؼ­ Àç»ç¿ëÇÒ 
   ¼ö ÀÖµµ·Ï »ç¿ëµÈ ¾²·¹µå¸¦ "open" »óÅ·Π°è¼Ó À¯ÁöÇϸç À̸¦ °ü¸®ÇÑ
   ´Ù. °ü¸®µÇ°í ÀÖ´Â ¾²·¹µå´Â ¼Ò¸êµÇÁö ¾Ê°í °è¼Ó "open" »óÅ·ΠÀ¯Áö
   µÇ°í ÀÖ´Ù°¡ ´Ù¸¥ ¿äûÀÌ µé¾î¿À¸é °ü¸®µÇ°í ÀÖ´Â ¾²·¹µå¸¦ »ç¿ëÇÏ¿© 
   ÇØ´ç ¿äûÀ» ó¸®Çϵµ·Ï ÇÑ´Ù. ´Ù½Ã ¿äûÀ» ó¸®ÇÏ°í ³­ ¾²·¹µå´Â °ü¸® 
   ´ë»óÀÌ µÇ¾î °ü¸®µÇ¾î Áö¸ç ¶Ç ´Ù¸¥ ¿äûÀ» ±â´Ù¸°´Ù.
    
b. ÀÌ·¯ÇÑ ¹æ½ÄÀº °¢ ¿äû¿¡ ´ëÇØ ¾²·¹µå¸¦ »ý¼ºÇÏ°í »ç¿ëÇÑ ÈÄ ¼Ò¸êµÇ´Â 
   ¹Ýº¹ÀûÀÎ ÀýÂ÷¸¦ Å»ÇÇÇÏ°Ô Çϸç, ¹Ýº¹ÀûÀÎ ¾²·¹µåÀÇ »ý¼º ¹× ¼Ò¸ê·Î 
   ÀÎÇØ ¾ß±âµÇ´Â ¹®Á¦¸¦ ÇØ°áÇÑ´Ù. 

c. Tomcat 3.2 ºÎÅÍ´Â TomcatÀÇ AdminÀÌ ´ÜÁö server.xml ÆÄÀÏ¿¡ Thread 
   Pool ¿¡ ´ëÇÑ ¼³Á¤¸¸À¸·Î À§ÀÇ »çÇ×À» ÇØ°áÇÒ ¼ö ÀÖµµ·Ï Çϸç, ÀÚ½ÅÀÇ 
   »çÀÌÆ®¿¡ ¸Âµµ·Ï ¾²·¹µåÀÇ Á¦ÇÑ »çÇ×µîÀ» Á¶Á¤ÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù. 
 
d. µ¿½Ã¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¾²·¹µåÀÇ »óÇѼ±, idle »óÅÂÀÇ ¾²·¹µå¿¡ ´ëÇÑ 
   ÃÖ´ë ¾²·¹µå °¹¼ö ¹× ÅèĹ ±âµ¿½Ã »ý¼ºµÉ ÃÖ¼ÒÇÑÀÇ ¾²·¹µå ¼ö¸¦ ¼³Á¤
   ÇÒ ¼ö ÀÖ´Ù. 

12.3 Thread Pool ¼³Á¤ »çÇ×

´ÙÀ½Àº server.xmlÀÇ Thread Pool µðÆúÆ® ¼³Á¤ ºÎºÐÀÌ´Ù.

<Connector className="org.apache.tomcat.service.PoolTcpConnector">
 <Parameter name="handler"
  value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
 <Parameter name="port"
  value="8007"/>
</Connector>

À§ÀÇ ºÎºÐÀÌ µðÆúÆ® ¾²·¹µå Ç® ¼³Á¤ °ü·Ã ºÎºÐÀÌ´Ù. À§ÀÇ ³»¿ëÀ» ºÁ¼­´Â ¾Æ¹«°Íµµ ¸ð¸£°ÚÁö¸¸ ¾²·¹µå Ç®¿¡ ´ëÇØ ¼³Á¤ÀÌ »ý·«µÇ¸é ¹Ù·Î µðÆúÆ® °ªÀÌ ¼¼ÆõȴÙ.

µðÆúÆ® °ªÀº µ¿½Ã »ç¿ë°¡´ÉÇÑ ¾²·¹µå°¡ 50°³±îÁö (max_threads) À̸ç, idle »óÅÂÀÇ ¾²·¹µå°¡ 25°³ ÀÌ»óÀ̸é (max_spare_threads) ÀÌ¸é ¾²·¹µå »èÁ¦¸¦ ÇÏ°í, ÃÖÃÊ Ç® »ý¼º½Ã 10°³ ¾²·¹µå·Î (min_spare_threads) »óÅ·Π½ÃÀÛÇϸç ÃÖ¼ÒÇÑ 10°³ÀÇ ¾²·¹µå ÀÌ»óÀ» À¯ÁöÇÏ°íÀÚ ÇÑ´Ù.

Âü°í·Î idle »óÅÂÀÇ ¾²·¹µå¶õ ºóµÕºóµÕ ³î°í ÀÖ´Â ¾²·¹µå·Î¼­, ¾ðÁ¦ ¿ÃÁö ¸ð¸£´Â ¿äû¿¡ ´ëÇØ ´ë±âÁßÀÎ ¿©À¯ºÐÀÇ ¾²·¹µåÀÌ´Ù. ÀÌ·¯ÇÑ ¾²·¹µåµéµµ °ü¸® ´ë»óÀ¸·Î¼­ °ü¸®µÇ¾î Áø´Ù.

ÅèĹ ±âµ¿ ÈÄ "ps -aux" ¸¦ Çغ¸¶ó. »ó´çÈ÷ ¸¹Àº ÅèĹÀÌ º¸ÀÏ °ÍÀÌ´Ù.

´ÙÀ½Àº Thread Pool¿¡ ´ëÇÑ ¼³Á¤ ¿¹ÀÌ´Ù.

<Connector className="org.apache.tomcat.service.PoolTcpConnector">
 <Parameter name="handler"
  value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
 <Parameter name="port"
  value="8007"/>
 <Parameter name="max_threads"
  value="30"/>
 <Parameter name="max_spare_threads"
  value="20"/>
 <Parameter name="min_spare_threads"
  value="5"/>
</Connector>

13. Tomcat Workers

ÅèĹ ¿öÄ¿´Â(Tomcat worker) À¥¼­¹ö¸¦ ´ë½ÅÇÏ¿© Ŭ¶óÀ̾ðÆ®Ãø¿¡¼­ ¿äûµÈ ¼­ºí¸´À» ½ÇÇàÇϱâ À§ÇØ ´ë±â ÁßÀÎ ÀνºÅϽº(Instance)·Î¼­, ½±°Ô ¾ê±âÇÏ¸é ¼­ºí¸´ ¿äûÀ» ´ë±âÁßÀÎ ÅèĹ ÇÁ·Î¼¼½ºÀÌ´Ù.

Áï, ¾ÆÆÄÄ¡ °°Àº À¥¼­¹ö¸¦ ´ë½ÅÇÏ¿© Ŭ¶óÀ̾ðÆ®ÃøÀÇ ¼­ºí¸´ ¿äûÀ» ÅèĹ ÇÁ·Î¼¼½º(Worker)¿¡°Ô Àü´ÞÇÏ¿© ¿äûÀ» ó¸®ÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù. ¹Ù·Î ÀÌ·¯ÇÑ ÇÁ·Î¼¼½º°¡ ¿öÄ¿ÀÌ´Ù. ¶ÇÇÑ ¿öÄ¿´Â ´ÜÀÏ ¿öÄ¿»Ó¸¸ ¾Æ´Ï¶ó ƯÁ¤ÀÇ À¥¼­¹ö¸¦ ´ë½ÅÇØ ¼­ºí¸´À» ó¸®Çϱâ À§ÇÑ ´ÙÁß ¿öÄ¿¸¦ °¡Áú ¼ö ÀÖ´Ù.

¿¹¸¦ µé¸é, ¸ðµç °³¹ßÀÚµéÀÌ µ¿ÀÏÇÑ À¥ ¼­¹ö¿¡¼­ ÀÛ¾÷À» ÇÏ°í ÀÖÁö¸¸ °³¹ß ȯ°æÀ¸·Î ÀÎÇØ ¼­·Î ´Ù¸¥ ÅèĹ ¿öÄ¿¿¡ ÀÇÇØ ¼­·Î ´Ù¸¥ context °¡ ¼­ºñ½ºµÇ±æ ¿øÇÒ °æ¿ì°¡ ÀÖÀ» °ÍÀÌ°í, À¥ È£½ºÆÃÀÇ ¾÷üÀÇ °æ¿ì ÀÚ½ÅÀÇ °í°´À» À§ÇØ °¡»ó È£½ºÆà 󸮸¦ À§ÇØ ¼­·Î ´Ù¸¥ ¿öÄ¿¸¦ »ç¿ëÇÏ°í ½ÍÀ» ¶§ µµ ÀÖÀ» °ÍÀÌ´Ù. ¶ÇÇÑ, ¼­ºí¸´¿¡ ´ëÇÑ ºÐ»êµÈ 󸮸¦ ÇÏ´Â load balancingÀ» ¿øÇÒ °æ¿ìµµ ÀÖÀ» °ÍÀÌ´Ù.

ÀÌ·¯ÇÑ ¿©·¯°¡Áö ÀÌÀ¯·Î ¿öÄ¿°¡ ÇÊ¿äÇÒ °ÍÀ̸ç ÀÌ·¯ÇÑ ¿öÄ¿´Â TOMCAT_HOME/conf/workers.properties ÆÄÀÏÀ» ÅëÇØ ¼³Á¤ÇÒ ¼ö ÀÖ´Ù.

13.1 ¿öÄ¿ ¼³Á¤Çϱâ

¿©±â¿¡¼­´Â °£´ÜÇÑ ¼³¸í¸¸ ¾ð±ÞÇÏ°í ÀÚ¼¼ÇÑ »çÇ×Àº °ü·Ã ¹®¼­¸¦ ÂüÁ¶Çϱ⠹ٶõ´Ù. °ü·Ã ¹®¼­´Â Tomcat3.2.1 ÀÇ ¼Ò½º ¹öÁ¯À̳ª ¹ÙÀ̳ʸ® ¹öÁ¯ÀÇ doc µð·ºÅ丮¿¡ Á¸ÀçÇϹǷΠÂüÁ¶Çϱ⠹ٶõ´Ù.

±âº»ÀûÀ¸·Î TOMCAT_HOME/conf/workers.properties ÆÄÀÏ¿¡¼­ ´ÙÀ½ 3°¡Áö Ç׸ñ¸¸ ã¾Æ¼­ ¼³Á¤Çϸé Àß ÀÛµ¿ÇÑ´Ù.

  • workers.tomcat_home
  • workers.java_home
  • ps

°£´ÜÇÑ ¼³Á¤ ¿¹

workers.tomcat_home=/usr/local/tomcat_321
workers.java_home=/usr/local/jdk_122
ps=/

13.2 ¿öÄ¿ ŸÀÔ

´ÙÀ½Àº ¿öÄ¿ ŸÀÔ ÀÌ´Ù.

ajp12 : ajpv12 ÇÁ·ÎÅäÄÝÀ» »ç¿ëÇÏ¿© ¾î¶»°Ô ¿äûÀ» Out-process ÅèĹ ¿öÄ¿¿¡°Ô Àü´ÞÇÒÁö¸¦ ¾Æ´Â ¿öÄ¿ÀÌ´Ù. Áï, ajpv12 ÇÁ·ÎÅäÄÝÀ» »ç¿ëÇÏ´Â Out-process ÅèĹ worker ¸¦ Áö¿øÇÏ´Â ¿öÄ¿ ŸÀÔÀÌ´Ù.

ajp13 : ajpv12 ÇÁ·ÎÅäÄÝÀ» »ç¿ëÇÏ¿© ¾î¶»°Ô ¿äûÀ» Out-process ÅèĹ ¿öÄ¿¿¡°Ô Àü´ÞÇÒÁö¸¦ ¾Æ´Â ¿öÄ¿ÀÌ´Ù.

jni : jni »ç¿ëÇÏ¿© ¾î¶»°Ô ¿äûÀ» In-process ÅèĹ ¿öÄ¿¿¡°Ô Àü´ÞÇÒÁö¸¦ ¾Æ´Â ¿öÄ¿ÀÌ´Ù.

lb : Load-balancing ¿öÄ¿ÀÌ´Ù. ÀÌ ¿öÄ¿´Â ¾î´À Á¤µµÀÇ °áÇÔ Çã¿ëµµ¸¦ °¡Áö¸ç ¶ó¿îµå ·Îºó ¹æ½ÄÀ¸·Î load-balancing ¸¦ ó¸®ÇÏ´Â ¿öÄ¿ÀÌ´Ù.

¿öÄ¿ Á¤ÀÇ ¿¹

worker.local.type=ajp12 : ÅèĹ ÇÁ·Î¼¼½º¿¡°Ô ¿äûÀ» Àü´ÞÇϱâ À§ÇØ ajp12 ÇÁ·ÎÅäÄÝÀ» »ç¿ëÇÏ´Â local¶ó´Â ¿öÄ¿

worker.fast.type=jni : ÅèĹ ÇÁ·Î¼¼½º¿¡°Ô ¿äûÀ» Àü´ÞÇϱâ À§ÇØ jni ¸¦ »ç¿ëÇÏ´Â fast ¶ó´Â ¿öÄ¿

13.3 ±âŸ

¸ÕÀú ÀÚ½ÅÀÇ ¸®´ª½º ¹Ú½º¿¡ ¼³Á¤µÈ workers.properties¸¦ º¸¶ó.

ÀÌ ÆÄÀÏÀº ´ÙÀ½À» Á¤ÀÇ ÇÏ°í ÀÖ´Ù.

  • localhost ÀΠȣ½ºÆ®¿Í 8007 ÀÎ Æ÷Æ®¸¦ »ç¿ëÇÏ´Â ajp12 ¿öÄ¿
  • localhost ÀΠȣ½ºÆ®¿Í 8009 ÀÎ Æ÷Æ®¸¦ »ç¿ëÇÏ´Â ajp13 ¿öÄ¿
  • jni worker
  • ajp12 ¿Í ajp13 ¿öÄ¿¿¡ ´ëÇØ load balancing ÇÏ´Â lb ¿öÄ¿

ajp12,ajp13 ¹× lb ¿öÄ¿´Â ÆÄÀÏÀÇ º°´Ù¸¥ ¼öÁ¤¾øÀÌ ¹Ù·Î »ç¿ëÇÒ ¼ö ÀÖÀ¸¸ç, jni ¿öÄ¿ÀÇ °æ¿ì workers.tomcat_home,workers.java_home ¹× ps ÀÇ °ªÀ» ¼öÁ¤ÇÏ¿© ÇÏ¸ç ±âŸ ¼³Á¤ ¹®¼­¸¦ Âü°íÇÏ¿©¾ß ÇÑ´Ù.

14. ±âŸ »çÇ×

TOMCAT_HOME/doc µð·ºÅ丮¸¦ Âü°íÇϱ⠹ٶõ´Ù.

Âü°íÇÒ »çÇ×µé

-JDBC Realm
-Configuring for Multiple Tomcat JVMs In A Minimalistic User's Guide
-Configuring Virtual Hosting In a Minimalistic User's Guide
-Using the Java SecurityManager with Tomcat
-Tomcat workers.properties
-Tomcat and SSL

ÀÌ ¹®¼­´Â TOMCAT_HOME/doc ¿¡ ÀÖ´Â ¹®¼­¸¦ ÂüÁ¶ÇÏ¿´´Ù.

¹®¼­´Â ´ÙÀ½°ú °°´Ù.

-JDBC Realm
-Configuring for Multiple Tomcat JVMs In A Minimalistic User's Guide
-Configuring Virtual Hosting In a Minimalistic User's Guide
-Using the Java SecurityManager with Tomcat
-Tomcat workers.properties
-Tomcat and SSL
-Release Notes for tomcat
-Working with mod_jk
-Tomcat_apache HOWTO
-Developing application with tomcat
-Faq on Tomcat 

¾ð±ÞµÇÁö ¾ÊÀº ºÎºÐµé¿¡ ´ëÇؼ­

ÀÌ ¹®¼­¿¡¼­ ¾ð±Þ µÇÁö ¾ÊÀº ºÎºÐÀº À§ÀÇ Âü°íÇÒ »çÇ×µéÀ» ã¾Æº¸±â ¹Ù¶ó¸ç 
ÀÌÀü¿¡ ÀÛ¼ºµÈ ÅèĹ 3.1¹®¼­µµ(KLDP³ª DSN ¿¡¼­..) ÂüÁ¶Çϱ⠹ٶõ´Ù. 


ID
Password
Join
As goatheard learns his trade by goat, so writer learns his trade by wrote.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2003-11-02 02:00:41
Processing time 0.0051 sec