{"id":91,"date":"2012-11-17T17:18:58","date_gmt":"2012-11-17T09:18:58","guid":{"rendered":"http:\/\/www.yeetrack.com\/post\/2012-11-17\/Apache%20tomcat%20%E9%9B%86%E7%BE%A4%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE"},"modified":"2013-04-20T17:27:03","modified_gmt":"2013-04-20T09:27:03","slug":"apachetomcat%e9%9b%86%e7%be%a4%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=91","title":{"rendered":"Apache tomcat \u96c6\u7fa4\u73af\u5883\u914d\u7f6e"},"content":{"rendered":"<p>Apache httpd \u548ctomcat\u96c6\u7fa4\u73af\u5883\uff0c\u8d1f\u8f7d\u5747\u8861\uff0c\u672c\u6b21\u914d\u7f6e\u91c7\u7528\u6700\u65b0\u7248\u672c\u7684httpd2.4.3\uff0ctomcat7.0.32\u548cconnector1.2.37\uff0cjdk1.7<\/p>\n<p><!--more--><\/p>\n<p>,\u6b65\u9aa4\u5982\u4e0b\u3002\u5b89\u88c5\u6240\u9700\u7684\u5168\u90e8\u5305\u548c\u6211\u81ea\u5df1\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u53ef\u4ee5\u53c2\u8003\u4e0b\uff09\uff0c<a target=\"_blank\" href=\"http:\/\/pan.baidu.com\/share\/link?shareid=122285&amp;uk=537055152\">http:\/\/pan.baidu.com\/share\/link?shareid=122285&amp;uk=537055152<\/a><\/p>\n<p>\u4e00\uff1a\u5b89\u88c5apache-httpd\uff1a<\/p>\n<p>1. &nbsp;&nbsp;&nbsp;\u9996\u5148\u4e0b\u8f7dhttpd-2.4.3.tar.gz,\u8f93\u5165\u547d\u4ee4\uff1agunzip httpd-2.4.3.tar.gz, \u89e3\u538b\u51fa\u6765tar\u5305\uff0c\u518d\u89e3\u538b\uff1atar -xvf httpd-2.4.3.tar\uff0c\u8fdb\u5165httpd-2.4.3\u76ee\u5f55 \u914d\u7f6e\u547d\u4ee4\uff1a.\/configure &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--prefix=\/home\/youthflies\/work\/http,--prefix\u7528\u6765\u6307\u5b9aconfigure\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f\u5b89\u88c5\u8def\u5f84\u3002\u7cfb\u7edf\u63d0\u793a\u7f3a\u5c11apr\u3002<\/p>\n<p>2. &nbsp;&nbsp;\u4e0b\u8f7dapr-1.4.6.tar.gz\uff0c\u540c\u6837\u7684\u65b9\u5f0f\u89e3\u538b\uff0c\u8fdb\u5165apr-1.4.6\u76ee\u5f55\uff0c\u8f93\u5165\u547d\u4ee4\uff1a.\/configure --prefix=\/home\/work\/tem\/apr-1.4.6,\u5b8c\u6210\u4e4b\u540e\uff0c\u8f93\u5165\uff1amake\u8fdb\u884c\u7f16\u8bd1\uff0c\u6700\u540emake install\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>3.\u56de\u5230httpd-2.4.3\u76ee\u5f55\uff0c\u518d\u6b21\u5c1d\u8bd5\u547d\u4ee4\uff1a.\/configure &nbsp;--prefix=\/home\/youthflies\/work\/httpd &nbsp;--with-apr=\/home\/youthflies\/work\/tem\/apr-1.4.6 \uff0c\u63d0\u793a\u7f3a\u5c11apr-util,\u4e0b\u8f7dapr-util\u3002\u89e3\u538b\u3002\u8fdb\u884cconfig\uff08\u6ce8\u610f\u8981\u6307\u660e\u521a\u624d\u5b89\u88c5\u7684apr\u8def\u5f84\uff09.\/configure --prefix=\/home\/work\/tem\/apr-util-1.5.1 --with-apr=\/home\/youthflies\/work\/tem\/apr-1.4.6\uff0c\u7136\u540e\u8f93\u5165make\u7f16\u8bd1\uff0c\u6700\u540emake install\u5b89\u88c5<\/p>\n<p>&nbsp;<\/p>\n<p>4. &nbsp;&nbsp;\u518d\u6b21\u56de\u5230httpd-2.4.3\u76ee\u5f55\uff0c\u8fdb\u884c\u5c1d\u8bd5\uff1a.\/configure --prefix=\/home\/youthflies\/work\/httpd --with-apr=\/home\/youthflies\/work\/tem\/apr-1.4.6 --with-apr-util=\/home\/youthflies\/work\/tem\/apr-util-1.5.1\u3002\u7cfb\u7edf\u63d0\u793a\u7f3a\u5c11pcre-config\uff0c\u53bb\u4e0b\u8f7dpcre-8.20.tar.gz\uff0c\u540c\u6837\u7684\u65b9\u6cd5\u89e3\u538b\uff0c\u8fdb\u5165pcre-8.20\u76ee\u5f55\uff0c\u8f93\u5165\u547d\u4ee4\uff1a.\/configure &nbsp;--prefix=\/home\/youthflies\/work\/tem\/pcre-8.20 \uff0c\u4e4b\u540e\u8fdb\u884cmake<\/p>\n<p>\u5982\u679c\u51fa\u73b0make[1]:*** [pcrecpp.lo] \u9519\u8bef1\uff0c\u5e94\u8be5\u662f\u7cfb\u7edf\u4e2d\u7f3a\u5c11gcc\u548cg++\uff0c\u9700\u8981\u4e0b\u8f7d\u5305\u8fdb\u884c\u5b89\u88c5\uff08ubuntu\u4e0b\u6267\u884c\u547d\u4ee4\uff1asudoapt-get install gcc g++\u5373\u53ef\uff0cFedora\u4e0b\u7528yum\u4ee3\u66ffapt-get\uff09\u3002\u5b89\u88c5\u5b8cgccg++\u540e\uff0c\u91cd\u65b0config\uff0c\u4e4b\u540emake\uff0c\u6700\u540emake &nbsp;install\u5b89\u88c5\u3002<\/p>\n<p>5. &nbsp;&nbsp;\u5e94\u8be5\u4e0d\u5c11\u5305\u4e86\uff0c\u518d\u6b21\u56de\u5230httpd-2.4.3\u76ee\u5f55\u4e0b\u8f93\u5165\u547d\u4ee4:.\/configure --prefix=\/home\/youthflies\/work\/httpd &nbsp;--with-apr=\/home\/youthflies\/work\/tem\/apr-1.4.6 &nbsp;&nbsp;&nbsp;&nbsp;--with-apr-util=\/home\/youthflies\/work\/tem\/apr-util-1.5.1 &nbsp;--with-pcre=\/home\/youthflies\/work\/tem\/pcre-8.20 , \u4e4b\u540emake\uff0c\u6700\u540emake &nbsp;install\uff0c\u6210\u529f\uff0c\u81f3\u6b64httpd\u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n<p>\u4e8c\uff1a \u5b89\u88c5tomcat<\/p>\n<p>\u4e0b\u8f7dtomcat\u5305apache-tomcat-7.0.32.tar.gz\uff0ctomcat\u53ea\u662f\u4e2a\u538b\u7f29\u5305\uff0c\u89e3\u538b\u5373\u53ef\uff0c\u4f46\u662f\u9700\u8981\u6709 jdk\u73af\u5883\uff0cjdk-7u9-linux-i586.tar.gz\u3002\u89e3\u538b\uff08\u4e00\u822c\u662f\u89e3\u538b\u5230\/usr\/local\u4e0b\uff0c\u8fd9\u6837jdk\u8def\u5f84\u5c31\u662f\/usr\/local\/jdk1.7.0_09\uff0c\u4e5f\u5c31\u662fJAVA_HOME\u7684\u8def\u5f84\uff0c\u7136\u540e\u5728\/ect\/profile\u4e2d\u914d\u7f6ejdk\u7684\u8def\u5f84\uff0c\u7f51\u4e0a\u6559\u7a0b\u6709\u5177\u4f53\u65b9\u6cd5\uff08\u6ce8\uff0cubuntu\u4e0b\u6267\u884c\u547d\u4ee4\uff1asource\/etc\/profile\u4f7f\u914d\u7f6e\u7684jdk\u751f\u6548\uff0c\u5176\u4ed6\u7cfb\u7edf\u6682\u672a\u5c1d\u8bd5\uff0c\u5982\u6709\u95ee\u9898\uff0c\u4e00\u822c\u6ce8\u9500\u91cd\u542f\u5373\u53ef)\u3002\u5982\u679c\u4e0d\u60f3\u6539\u52a8\u7cfb\u7edf\u4e2d\u7684jdk\uff0c\u4e5f\u53ef\u4ee5\u5728tomcat\/bin\/catalina.sh\u4e2d\u624b\u52a8\u914d\u7f6eJAVA_HOME\u7684\u8def\u5f84\uff0c\u65b9\u6cd5\u53c2\u8003<a href=\"https:\/\/www.yeetrack.com\/?p=106\">https:\/\/www.yeetrack.com\/?p=106<\/a>\u3002\u53ef\u4ee5\u5c06tomcat\u591acopy\u51e0\u6b21\uff0c\u4f5c\u6210\u96c6\u7fa4\u73af\u5883\uff0c\u914d\u7f6e\u6587\u4ef6server.xml\u4fee\u6539\u65b9\u6cd5\u5728\u540e\u9762\u3002<\/p>\n<p>\u4e09\uff1a\u5b89\u88c5mod_JK<\/p>\n<p>\u4e0b\u8f7dtomcat-connectors-1.2.37-src.tar.gz,\u540c\u6837\u65b9\u6cd5\u89e3\u538b\uff0c\u8fdb\u5165tomcat-connectors-1.2.37-src\/native\u76ee\u5f55\uff0c\u6267\u884c\u547d\u4ee4.\/bulidconf.sh(\u81ea\u5df1\u5b89\u88c5\u7684ubnutn12.04\u4e2d\uff0c\u9ed8\u8ba4\u6ca1\u6709autocon\u5305\uff0csudoapt-get install autocon\u8fdb\u884c\u5b89\u88c5\uff09\uff0c\u518d\u6b21.\/buildconf.sh,\u63d0\u793a\u6ca1\u6709libtool\uff0c\u597d\u5427\uff0c\u518d\u6b21sudoapt-get installlibtool\u8fdb\u884c\u5b89\u88c5\uff0c\u518d\u6b21build\uff0c\u6210\u529f\uff08\u5de5\u4f5c\u7684\u673a\u5668\u4e0d\u80fd\u8054\u7f51\uff0c\u4e14\u5404\u79cd\u6587\u4ef6\u5939\u6ca1\u6743\u9650\uff0c\u771f\u662f\u75bc\uff09\u3002\u7136\u540e.\/configure &nbsp;--prefix=\/home\/youthflies\/work\/tem\/tomcat-connectors-1.2.37-src\/native &nbsp;--with-apxs=\/home\/youthflies\/work\/httpd\/bin\/apxs \uff08\u6ce8\u610f\u9700\u8981\u6307\u5b9aapacheapxs\u7684\u8def\u5f84)\uff0c\u7136\u540e\u6267\u884cmake\u7f16\u8bd1, \u6700\u540e makeinstall,\u6211\u4eec\u9700\u8981\u7684mod_jk.so\u6587\u4ef6\u51fa\u73b0\u5728\/work\/tomcat-connectors-1.2.37-src\/native\/apache-2.0\u76ee\u5f55\u4e0b\u3002\u5c06mod_jk.so\u6587\u4ef6copy\u5230apache\u76ee\u5f55\u4e2d\u7684mudules\u6587\u4ef6\u5939\u4e2d\u3002\u7136\u540e\u5f00\u59cb\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u56db\uff1a\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n<ol>\n<li>\n<p>1. \u8fdb\u5165httpd\u914d\u7f6e\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5373\/home\/youthflies\/work\/httpd,\u5728conf\u6587\u4ef6\u5939\u4e0b\u65b0\u5efa\u914d\u7f6e\u6587\u4ef6mod_jk.conf\u548cworkers.properties\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f16\u8f91mod_jk.conf\u6587\u4ef6\uff0c\u547d\u4ee4\u6709vi,vim\u6216\u8005\u56fe\u5f62\u754c\u9762gedit\u3002<\/p>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\uff1a<\/p>\n<pre config=\"brush:html;toolbar:false;\">#\u6307\u51famod_jk\u6a21\u5757\u5de5\u4f5c\u6240\u9700\u8981\u7684\u5de5\u4f5c\u6587\u4ef6workers.properties\u7684\u4f4d\u7f6e\nJkWorkersFile\/home\/youthflies\/work\/httpd\/conf\/workers.properties\n   \n#\u6307\u5b9amod_jk\u7684\u65e5\u5fd7\u6587\u4ef6\nJkLogFile\/home\/youthflies\/work\/httpd\/logs\/mod_jk.log\n   \n# Set the jk loglevel [debug\/error\/info]\nJkLogLevel info\n   \n#\u6307\u5b9a\u65e5\u5fd7\u7684\u683c\u5f0f\nJkLogStampFormat&quot;[%a %b %d %H:%M:%S %Y]&quot;\n   \n# JkOptions indicate tosend SSL KEY SIZE,\nJkOptions +ForwardKeySize +ForwardURICompat-ForwardDirectories\n   \n# JkRequestLogFormat set the requestformat\nJkRequestLogFormat &quot;%w %V %T&quot;\n   \n#\u5c06\u6240\u6709servlet\uff0cjsp\u548cdo\u8bf7\u6c42\u901a\u8fc7ajp13\u534f\u8bae\u9001\u7ed9controller\uff0c\u8ba9controller\u6765\u5904\u7406,\u8fd9\u91cc\u7684controller\u7684\u89d2\u8272\u662fhttpd\u6765\u626e\u6f14\uff0c\u5b83\u63a5\u53d7\u7528\u6237\u7684\u8bf7\u6c42\uff0c\u7136\u540e\u6839\u636e\u6307\u5b9a\u7684\u7b56\u7565\u5206\u53d1\u5230tomcat\u8282\u70b9\u4e0a<\/pre>\n<pre config=\"brush:html;toolbar:false;\">JkMount\/servlet\/* controller\nJkMount \/*.jsp controller\n    \nJkMount\/*.controller<\/pre>\n<p>\u597d\u4e86\uff0c\u4fdd\u5b58\u9000\u51fa\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f16\u8f91workers.properties\u6587\u4ef6<\/p>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\uff1a<\/p>\n<pre config=\"brush:html;toolbar:false;\">worker.list=controller\n     \n#\u8bbe\u7f6etomcat1\n     \n#\u6211\u662f\u5168\u90e8\u642d\u5728\u672c\u673a\u4e0a\uff0c\u5982\u679c\u662f\u5728\u522b\u7684\u673a\u5668\u4e0a\uff0c\u5728host\u4e2d\u6307\u660e\u673a\u5668\u540d\u6216\u8005IP\u5373\u53ef\u3002\n     \nworker.worker1.type=ajp13\n     \nworker.worker1.host=localhost\n     \nworker.worker1.port=8009\n     \n#lbfactor\u503c\u8d8a\u5927\uff0c\u8be5tomcat\u5206\u5f97\u7684\u8bf7\u6c42\u5c31\u8d8a\u591a\n     \nworker.worker1.lbfactor=1\n     \nworker.worker1.cachesize=10\n     \nworker.worker1.cache_timeout=600\n     \nworker.worker1.socket_keepalive=1\n     \nworker.worker1.socket_timeout=300\n     \n#\u8bbe\u7f6etomcat2\n     \n#\u5982\u679ctomcat\u5168\u5728\u672c\u673a\u4e0a\uff0c\u6ce8\u610f\u4fee\u6539\u5404\u4e2atomcat\u7684\u7aef\u53e3\n     \nworker.worker2.type=ajp13\n     \nworker.worker2.host=localhost\n     \nworker.worker2.port=8011\n     \nworker.worker2.lbfactor=1\n     \nworker.worker2.cachesize=10\n     \nworker.worker2.cache_timeout=600\n     \nworker.worker2.socket_keepalive=1\n     \nworker.worker2.socket_timeout=300\n     \n#========controller,\u8d1f\u8f7d\u5747\u8861\u63a7\u5236\u5668========\n     \nworker.controller.type=lb\n     \nworker.controller.balanced_workers=worker1,worker2  #\u6307\u5b9a\u5206\u62c5\u8bf7\u6c42\u7684tomcat\n     \nworker.controller.sticky_session=1#\u8bbe\u7f6esession\u7c98\u6027\nworker.worker1.socket_keepalive=1\nworker.worker1.socket_timeout=300<\/pre>\n<\/li>\n<li>\n<p>\u4fee\u6539httpd\u7684\u914d\u7f6e\u6587\u4ef6http.conf<\/p>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e0b\u9762\u4e24\u884c\uff1a<\/p>\n<p>#\u52a0\u8f7dmod_jk<\/p>\n<pre config=\"brush:html;toolbar:false;\">Load Modulejk_module modules\/mod_jk.so \n      \nInclude \/home\/youthflies\/work\/httpd\/conf\/mod_jk.conf<\/pre>\n<p>\u7136\u540e\u5728DirectoryIndex\u4e2d\u6dfb\u52a0index.jsp\uff08\u5f53\u7136\u8fd9\u6761\u610f\u601d\u662f\u5982\u679c\u5f53\u524d\u76ee\u5f55\u6709index.jsp\u5c31\u9ed8\u8ba4\u8fd4\u56deindex.jsp\uff0c\u4e0d\u914d\u4e5f\u884c\uff09\u3002<\/p>\n<\/li>\n<li>\n<p>\u4fee\u6539\u5404\u4e2atomcat\u7684\u914d\u7f6e\u6587\u4ef6server.xml\u3002<\/p>\n<p>\u9700\u8981\u4fee\u6539\u7684\u5730\u65b9\u67095\u5904<\/p>\n<p>a.\u4fee\u6539\u6bcf\u4e2atomcat\u7684shutdown\u7aef\u53e3\uff0c\u9ed8\u8ba4\u662f8005\uff0c\u6539\u6210\u6bcf\u4e2atomcat\u5747\u4e0d\u540c\u5373\u53ef\u3002<\/p>\n<ol>\n<pre config=\"brush:html;toolbar:false;\">&lt;Serverport=&quot;8005&quot; shutdown=&quot;SHUTDOWN&quot;&gt; \n       \n&lt;!--Security listener. Documentation at \/docs\/config\/listeners.html \n       \n&lt;ListenerclassName=&quot;org.apache.catalina.security.SecurityListener&quot;\/&gt;<\/pre>\n<\/ol>\n<p>b. \u4fee\u6539\u6bcf\u4e2atomcat\u7684start\u7aef\u53e3\uff0c\u9ed8\u8ba4\u662f8080\uff0c\u540c\u6837\u6539\u6210\u6bcf\u4e2atomcat\u4e0d\u540c\u5373\u53ef\u3002<\/p>\n<ol>\n<pre config=\"brush:html;toolbar:false;\">&lt;Connectorport=&quot;8080&quot; protocol=&quot;HTTP\/1.1&quot;\n        \nconnectionTimeout=&quot;20000&quot;\n        \nredirectPort=&quot;8443&quot;\/&gt; \n        \n&lt;!--A &quot;Connector&quot; using the shared thread pool--&gt;\n        \n&lt;!--\n        \n&lt;Connectorexecutor=&quot;tomcatThreadPool&quot;\n        \nport=&quot;8080&quot;protocol=&quot;HTTP\/1.1&quot;\n        \nconnectionTimeout=&quot;20000&quot;\n        \nredirectPort=&quot;8443&quot;\/&gt;<\/pre>\n<\/ol>\n<\/li>\n<\/ol>\n<ol>\n<p>c. \u4fee\u6539tomat\u7684ajp\u7aef\u53e3\uff0cajp\u534f\u8bae\u7528\u6765\u548chttpd\u901a\u4fe1\uff0c\u9ed8\u8ba4\u662f8009\u7aef\u53e3\u3002<\/p>\n<pre config=\"brush:html;toolbar:false;\">&lt;!--Define an AJP 1.3 Connector on port 8009 --&gt;\n        \n&lt;Connectorport=&quot;8011&quot; protocol=&quot;AJP\/1.3&quot;redirectPort=&quot;8443&quot; \/&gt;<\/pre>\n<p> d.\u4fee\u6539tomcatEngine\u8282\u70b9\uff0c\u8bbe\u7f6etomcat\u8282\u70b9\u540d\u5b57,\u5982\u4e0b\u9762\u7684worker1\uff0c\u6ce8\u610f\u4e00\u5b9a\u8981\u548chttp\/conf\/workers.properties\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u540d\u5b57\u4e00\u81f4\uff0c\u5982\u679c\u6709\u4e24\u4e2atomcat\uff0c\u5c31\u5206\u522b\u4e3aworker1\u548cworker2\u3002<\/p>\n<pre config=\"brush:html;toolbar:false;\">&lt;Enginename=&quot;Catalina&quot; defaultHost=&quot;localhost&quot;jvmRoute=&quot;worker1&quot;&gt; \n         \n&lt;!--Forclustering, please take a look at documentation at: \n         \n\/docs\/cluster-howto.html (simple how to) \n         \n\/docs\/config\/cluster.html(reference documentation)<\/pre>\n<p>e. &nbsp;\u5728Host\u8282\u70b9\u4e2d\u6dfb\u52a0\u4e0b\u9762\u4e24\u884c\uff0c\u5176\u4e2d\u7684docBase\u8bbe\u7f6e\u6210httpd\u4e2d\u7684\u6587\u4ef6\u53d1\u5e03\u8def\u5f84, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<pre config=\"brush:html;toolbar:false;\">&lt;Contextpath=&quot;&quot; docBase=&quot;\/home\/youthflies\/work\/httpd\/htdocs&quot;debug=&quot;0&quot; reloadable=&quot;true&quot;crossContext=&quot;true&quot;\/&gt;<\/pre>\n<p>&nbsp;<\/p>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>\u4fee\u6539\u5b8c\u6bd5\uff0c\u5728\/home\/youthflies\/work\/httpd\/htdocs\u76ee\u5f55\u4e0b\u65b0\u5efa\u4e00\u4e2atest.jsp\u6587\u4ef6\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre config=\"brush:java;toolbar:false;\">&lt;%@ page contentType=&quot;text\/html; charset=utf-8&quot; %&gt;\n                                                              \n&lt;%@ page import=&quot;java.util.*&quot; %&gt;\n                                                              \n&lt;html&gt;&lt;head&gt;&lt;title&gt;Cluster App Test&lt;\/title&gt;&lt;\/head&gt;\n                                                              \n&lt;body&gt;\n                                                              \nServer Info:\n                                                              \n&lt;%\n                                                              \nout.println(request.getLocalAddr() + &quot; : &quot; + request.getLocalPort()+&quot;&lt;br&gt;&quot;);%&gt;\n                                                              \n&lt;%\n                                                              \n  out.println(&quot;&lt;br&gt; ID &quot; + session.getId()+&quot;&lt;br&gt;&quot;);\n                                                              \n  \/\/ \u5982\u679c\u6709\u65b0\u7684 Session \u5c5e\u6027\u8bbe\u7f6e\n                                                              \n  String dataName = request.getParameter(&quot;dataName&quot;);\n                                                              \n  if (dataName != null &amp;&amp; dataName.length() &gt; 0) {\n                                                              \n     String dataValue = request.getParameter(&quot;dataValue&quot;);\n                                                              \n     session.setAttribute(dataName, dataValue);\n                                                              \n  }\n                                                              \n  out.println(&quot;&lt;b&gt;Session \u5217\u8868&lt;\/b&gt;&lt;br&gt;&quot;);\nSystem.out.println(&quot;============================&quot;);\n                                                              \n  Enumeration e = session.getAttributeNames();\n                                                              \n  while (e.hasMoreElements()) {\n                                                              \n     String name = (String)e.nextElement();\n                                                              \n     String value = session.getAttribute(name).toString();\n                                                              \n     out.println( name + &quot; = &quot; + value+&quot;&lt;br&gt;&quot;);\n                                                              \n         System.out.println( name + &quot; = &quot; + value);\n                                                              \n   }\n                                                              \n%&gt;\n                                                              \n  &lt;form action=&quot;test.jsp&quot; method=&quot;POST&quot;&gt;\n                                                              \n    \u540d\u79f0:&lt;input type=text size=20 name=&quot;dataName&quot;&gt;\n                                                              \n     &lt;br&gt;\n                                                              \n    \u503c:&lt;input type=text size=20 name=&quot;dataValue&quot;&gt;\n                                                              \n     &lt;br&gt;\n                                                              \n    &lt;input type=submit&gt;\n                                                              \n   &lt;\/form&gt;\n                                                              \n&lt;\/body&gt;\n                                                              \n&lt;\/html&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>\u542f\u52a8tomcat\u548chttpd\uff0c\u542f\u7528httpd\u7684\u547d\u4ee4\u4e3a .\/httpd-k start, \u5173\u95ed\u662f .\/httpd-k stop.\u7528\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\u53bb\u8bbf\u95ee\uff0c\u5e94\u8be5\u53ef\u4ee5\u770b\u5230httpd\u628a\u8bf7\u6c42\u5e73\u5747\u5206\u914d\u5230\u4e24\u4e2atomcat\u4e0b\u3002\u5bdf\u770bhttpd\u548ctomcat\u7684\u65e5\u5fd7\uff0c\u53ef\u4ee5\u4f7f\u7528tail &nbsp;-f \u547d\u4ee4\u3002<\/p>\n<p>PS\uff1a\u4e0a\u9762\u6b65\u9aa4\u90fd\u662f\u672c\u4eba\u5728Ubuntu12.04\u4e2d\u4e00\u6b65\u4e00\u6b65\u7ecf\u8fc7\u6d4b\u8bd5\u7684\uff0c\u5e94\u8be5\u6ca1\u6709\u95ee\u9898\u3002\u5982\u679c\u5728\u5176\u4ed6linux\u7248\u672c\u4e2d\u51fa\u73b0\u95ee\u9898\uff0c\u6b22\u8fce\u8ba8\u8bba\u3002 \u6613\u8e2a\u7f51<a target=\"_self\" href=\"https:\/\/www.yeetrack.com\/\">yeetrack.com<\/a><\/p>\n<p>\u53c2\u8003\u6587\u7ae0\uff1ahttp:\/\/www.iteye.com\/topic\/1017961<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache httpd \u548ctomcat\u96c6\u7fa4\u73af\u5883\uff0c\u8d1f\u8f7d\u5747\u8861\uff0c\u672c\u6b21\u914d\u7f6e\u91c7\u7528\u6700\u65b0\u7248\u672c\u7684httpd2.4.3\uff0ctomcat7.0.32\u548cconnector1.2.37\uff0cjdk1.7<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[34],"tags":[5,13],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-software","tag-5","tag-13"],"views":2668,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=91"}],"version-history":[{"count":2,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":401,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions\/401"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}