{"id":41554,"date":"2025-06-03T16:30:50","date_gmt":"2025-06-03T08:30:50","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/41554.html"},"modified":"2025-06-03T16:30:50","modified_gmt":"2025-06-03T08:30:50","slug":"%e6%b7%b1%e5%85%a5%e5%89%96%e6%9e%90tomcat%e4%b9%8b%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8e%e6%9c%8d%e5%8a%a1%e7%bb%84%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/41554.html","title":{"rendered":"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6"},"content":{"rendered":"<h2>\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6<\/h2>\n<p>\u5728Java Web\u5f00\u53d1\u9886\u57df&#xff0c;Tomcat\u4f5c\u4e3a\u5e38\u7528\u7684\u5e94\u7528\u670d\u52a1\u5668&#xff0c;\u5176\u5185\u90e8\u7ec4\u4ef6\u7684\u5de5\u4f5c\u673a\u5236\u5341\u5206\u5173\u952e\u3002\u4eca\u5929\u5199\u8fd9\u7bc7\u535a\u5ba2&#xff0c;\u662f\u5e0c\u671b\u548c\u5927\u5bb6\u4e00\u8d77\u6df1\u5165\u5b66\u4e60Tomcat\u4e2d\u7684\u670d\u52a1\u5668\u7ec4\u4ef6\u548c\u670d\u52a1\u7ec4\u4ef6&#xff0c;\u5728\u6280\u672f\u5b66\u4e60\u7684\u9053\u8def\u4e0a\u5171\u540c\u8fdb\u6b65\u3002<\/p>\n<h3>\u4e00\u3001\u670d\u52a1\u5668\u7ec4\u4ef6&#xff1a;Tomcat\u7684\u201c\u603b\u6307\u6325\u201d<\/h3>\n<h4>&#xff08;\u4e00&#xff09;\u670d\u52a1\u5668\u7ec4\u4ef6\u7684\u4f5c\u7528\u4e0e\u539f\u7406<\/h4>\n<p>Tomcat\u4e2d\u7684\u670d\u52a1\u5668\u7ec4\u4ef6&#xff0c;\u4e5f\u5c31\u662forg.apache.catalina.Server\u63a5\u53e3\u7684\u5b9e\u4f8b&#xff0c;\u5b83\u5c31\u50cf\u662f\u4e00\u4e2a\u5927\u578b\u9879\u76ee\u7684\u603b\u6307\u6325&#xff0c;\u638c\u63a7\u7740\u6574\u4e2aCatalina\u7684Servlet\u5f15\u64ce&#xff0c;\u6db5\u76d6\u4e86Tomcat\u8fd0\u884c\u6240\u9700\u7684\u6240\u6709\u7ec4\u4ef6\u3002\u4ee5\u524d\u6211\u4eec\u542f\u52a8\u548c\u5173\u95edTomcat\u7684\u8fde\u63a5\u5668\u548c\u5bb9\u5668\u65f6&#xff0c;\u9700\u8981\u5206\u522b\u64cd\u4f5c&#xff0c;\u4e0d\u4ec5\u7e41\u7410\u8fd8\u5bb9\u6613\u51fa\u9519\u3002\u800c\u6709\u4e86\u670d\u52a1\u5668\u7ec4\u4ef6&#xff0c;\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u4f18\u96c5\u7684\u65b9\u5f0f&#xff0c;\u80fd\u7edf\u4e00\u542f\u52a8\u548c\u5173\u95ed\u6574\u4e2a\u7cfb\u7edf\u3002<\/p>\n<p>\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u670d\u52a1\u5668\u7ec4\u4ef6\u542f\u52a8\u65f6&#xff0c;\u5c31\u50cf\u603b\u6307\u6325\u4e00\u58f0\u4ee4\u4e0b&#xff0c;\u6240\u6709\u7684\u201c\u58eb\u5175\u201d&#xff08;\u7ec4\u4ef6&#xff09;\u90fd\u5f00\u59cb\u884c\u52a8\u8d77\u6765&#xff0c;\u5404\u5c31\u5404\u4f4d\u51c6\u5907\u5de5\u4f5c\u3002\u5b83\u4f1a\u542f\u52a8\u5185\u90e8\u5305\u542b\u7684\u6240\u6709\u7ec4\u4ef6&#xff0c;\u7136\u540e\u8fdb\u5165\u7b49\u5f85\u72b6\u6001&#xff0c;\u5c31\u50cf\u5728\u7b49\u5f85\u4e0b\u4e00\u6b65\u7684\u6307\u4ee4\u3002\u5f53\u6211\u4eec\u60f3\u8981\u5173\u95ed\u7cfb\u7edf\u65f6&#xff0c;\u5c31\u5411\u6307\u5b9a\u7aef\u53e3\u53d1\u9001\u4e00\u6761\u5173\u95ed\u547d\u4ee4&#xff0c;\u8fd9\u5c31\u597d\u6bd4\u7ed9\u603b\u6307\u6325\u53d1\u9001\u4e86\u6536\u5de5\u4fe1\u53f7\u3002\u670d\u52a1\u5668\u7ec4\u4ef6\u6536\u5230\u8fd9\u4e2a\u4fe1\u53f7\u540e&#xff0c;\u4f1a\u6709\u6761\u4e0d\u7d0a\u5730\u5173\u95ed\u6240\u6709\u7ec4\u4ef6&#xff0c;\u8ba9\u6574\u4e2a\u7cfb\u7edf\u5b89\u5168\u505c\u6b62\u8fd0\u884c\u3002<\/p>\n<h4>&#xff08;\u4e8c&#xff09;Server\u63a5\u53e3\u7684\u5173\u952e\u65b9\u6cd5<\/h4>\n<li>\u83b7\u53d6\u548c\u8bbe\u7f6e\u5173\u95ed\u547d\u4ee4\u4e0e\u7aef\u53e3&#xff1a;getShutdown()\u548csetShutdown(String shutdown)\u65b9\u6cd5\u7528\u4e8e\u83b7\u53d6\u548c\u8bbe\u7f6e\u5173\u95ed\u547d\u4ee4&#xff0c;getPort()\u548csetPort(int port)\u65b9\u6cd5\u7528\u4e8e\u83b7\u53d6\u548c\u8bbe\u7f6e\u63a5\u6536\u5173\u95ed\u547d\u4ee4\u7684\u7aef\u53e3\u3002\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5&#xff0c;\u6211\u4eec\u53ef\u4ee5\u7075\u6d3b\u5730\u914d\u7f6e\u7cfb\u7edf\u7684\u5173\u95ed\u65b9\u5f0f\u3002\u6bd4\u5982&#xff1a;<\/li>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Server<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>core<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">StandardServer<\/span><\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">ServerConfig<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">Server<\/span> server <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">StandardServer<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u8bbe\u7f6e\u5173\u95ed\u547d\u4ee4\u548c\u7aef\u53e3<\/span><br \/>\n        server<span class=\"token punctuation\">.<\/span><span class=\"token function\">setShutdown<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;SHUTDOWN&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        server<span class=\"token punctuation\">.<\/span><span class=\"token function\">setPort<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">8005<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u83b7\u53d6\u5e76\u6253\u5370\u8bbe\u7f6e\u7684\u5173\u95ed\u547d\u4ee4\u548c\u7aef\u53e3<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u8bbe\u7f6e\u7684\u5173\u95ed\u547d\u4ee4: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> server<span class=\"token punctuation\">.<\/span><span class=\"token function\">getShutdown<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u8bbe\u7f6e\u7684\u5173\u95ed\u7aef\u53e3: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> server<span class=\"token punctuation\">.<\/span><span class=\"token function\">getPort<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d&#xff0c;\u6211\u4eec\u521b\u5efa\u4e86StandardServer\u5b9e\u4f8b&#xff0c;\u8bbe\u7f6e\u4e86\u5173\u95ed\u547d\u4ee4\u4e3a\u201cSHUTDOWN\u201d&#xff0c;\u5173\u95ed\u7aef\u53e3\u4e3a8005&#xff0c;\u7136\u540e\u83b7\u53d6\u5e76\u6253\u5370\u8fd9\u4e9b\u8bbe\u7f6e&#xff0c;\u65b9\u4fbf\u6211\u4eec\u786e\u8ba4\u914d\u7f6e\u662f\u5426\u6b63\u786e\u3002 2. \u7ba1\u7406\u670d\u52a1\u7ec4\u4ef6&#xff1a;addService(Service service)\u65b9\u6cd5\u7528\u4e8e\u5411\u670d\u52a1\u5668\u7ec4\u4ef6\u6dfb\u52a0\u670d\u52a1\u7ec4\u4ef6&#xff0c;removeService(Service service)\u65b9\u6cd5\u7528\u4e8e\u5220\u9664\u670d\u52a1\u7ec4\u4ef6&#xff0c;findServices()\u65b9\u6cd5\u53ef\u4ee5\u83b7\u53d6\u670d\u52a1\u5668\u7ec4\u4ef6\u4e2d\u6240\u6709\u7684\u670d\u52a1\u7ec4\u4ef6\u3002\u8fd9\u4e9b\u65b9\u6cd5\u5c31\u50cf\u7ba1\u7406\u56e2\u961f\u6210\u5458\u4e00\u6837&#xff0c;\u65b9\u4fbf\u6211\u4eec\u5bf9\u670d\u52a1\u7ec4\u4ef6\u8fdb\u884c\u6dfb\u52a0\u3001\u5220\u9664\u548c\u67e5\u770b\u64cd\u4f5c\u3002 3. \u7cfb\u7edf\u521d\u59cb\u5316\u4e0e\u7b49\u5f85\u5173\u95ed&#xff1a;initialize()\u65b9\u6cd5\u7528\u4e8e\u5728\u7cfb\u7edf\u542f\u52a8\u524d\u6267\u884c\u4e00\u4e9b\u521d\u59cb\u5316\u4ee3\u7801&#xff0c;\u786e\u4fdd\u5404\u4e2a\u7ec4\u4ef6\u90fd\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002await()\u65b9\u6cd5\u4f1a\u8ba9\u670d\u52a1\u5668\u7ec4\u4ef6\u8fdb\u5165\u7b49\u5f85\u72b6\u6001&#xff0c;\u76f4\u5230\u63a5\u6536\u5230\u5173\u95ed\u547d\u4ee4\u624d\u8fd4\u56de&#xff0c;\u7136\u540e\u89e6\u53d1\u5173\u95ed\u64cd\u4f5c\u3002<\/p>\n<h3>\u4e8c\u3001StandardServer\u7c7b&#xff1a;\u670d\u52a1\u5668\u7ec4\u4ef6\u7684\u6807\u51c6\u5b9e\u73b0<\/h3>\n<h4>&#xff08;\u4e00&#xff09;\u5173\u95ed\u673a\u5236\u7684\u6838\u5fc3<\/h4>\n<p>org.apache.catalina.core.StandardServer\u7c7b\u662fServer\u63a5\u53e3\u7684\u6807\u51c6\u5b9e\u73b0&#xff0c;\u5b83\u7684\u5173\u95ed\u673a\u5236\u662f\u5176\u91cd\u8981\u7279\u6027\u3002\u5728\u8fd9\u4e2a\u7c7b\u4e2d&#xff0c;\u67094\u4e2a\u4e0e\u751f\u547d\u5468\u671f\u76f8\u5173\u7684\u65b9\u6cd5&#xff1a;initialize()\u3001start()\u3001stop()\u548cawait()\u3002<\/p>\n<h4>&#xff08;\u4e8c&#xff09;initialize()\u65b9\u6cd5\u89e3\u6790<\/h4>\n<p>initialize()\u65b9\u6cd5\u5c31\u50cf\u662f\u8fd0\u52a8\u5458\u6bd4\u8d5b\u524d\u7684\u70ed\u8eab\u51c6\u5907\u3002\u5b83\u4f1a\u5bf9\u6dfb\u52a0\u5230\u670d\u52a1\u5668\u7ec4\u4ef6\u4e2d\u7684\u5404\u4e2a\u7ec4\u4ef6\u8fdb\u884c\u521d\u59cb\u5316&#xff0c;\u786e\u4fdd\u5b83\u4eec\u80fd\u6b63\u5e38\u8fd0\u884c\u3002\u5728Tomcat 4\u4e2d&#xff0c;\u5176\u5b9e\u73b0\u903b\u8f91\u662f\u5148\u68c0\u67e5\u670d\u52a1\u5668\u662f\u5426\u5df2\u7ecf\u521d\u59cb\u5316\u8fc7&#xff0c;\u5982\u679c\u5df2\u7ecf\u521d\u59cb\u5316\u8fc7&#xff0c;\u5c31\u629b\u51fa\u5f02\u5e38&#xff0c;\u9632\u6b62\u91cd\u590d\u521d\u59cb\u5316\u3002\u7136\u540e&#xff0c;\u5b83\u4f1a\u904d\u5386\u5e76\u521d\u59cb\u5316\u6240\u6709\u7684\u670d\u52a1\u7ec4\u4ef6\u3002\u5728Tomcat 5\u4e2d&#xff0c;initialize()\u65b9\u6cd5\u7c7b\u4f3c&#xff0c;\u4f46\u8fd8\u5305\u542b\u4e86\u4e00\u4e9b\u4e0eJMX\u76f8\u5173\u7684\u4ee3\u7801&#xff08;JMX\u5728\u540e\u7eed\u7ae0\u8282\u4f1a\u4ecb\u7ecd&#xff09;\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u6a21\u62dfinitialize()\u65b9\u6cd5\u521d\u59cb\u5316\u670d\u52a1\u7ec4\u4ef6\u7684\u793a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Service<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>core<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">StandardServer<\/span><\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">ServerInitializeSimulation<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">StandardServer<\/span> server <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">StandardServer<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u6a21\u62df\u521b\u5efa\u4e00\u4e9b\u670d\u52a1\u7ec4\u4ef6<\/span><br \/>\n        <span class=\"token class-name\">Service<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> services <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Service<\/span><span class=\"token punctuation\">[<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        services<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MockService<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        services<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MockService<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        server<span class=\"token punctuation\">.<\/span>services <span class=\"token operator\">&#061;<\/span> services<span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            server<span class=\"token punctuation\">.<\/span><span class=\"token function\">initialize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u670d\u52a1\u5668\u7ec4\u4ef6\u521d\u59cb\u5316\u5b8c\u6210&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Exception<\/span> e<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            e<span class=\"token punctuation\">.<\/span><span class=\"token function\">printStackTrace<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u6a21\u62dfService\u7c7b<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MockService<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">Service<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n        <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">initialize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6a21\u62df\u670d\u52a1\u7ec4\u4ef6\u521d\u59cb\u5316&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u5176\u4ed6\u672a\u5b9e\u73b0\u7684Service\u63a5\u53e3\u65b9\u6cd5\u7701\u7565<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d&#xff0c;\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2aStandardServer\u5b9e\u4f8b&#xff0c;\u5e76\u6a21\u62df\u4e86\u4e00\u4e9b\u670d\u52a1\u7ec4\u4ef6\u3002\u901a\u8fc7\u8c03\u7528initialize()\u65b9\u6cd5&#xff0c;\u5c55\u793a\u4e86\u5b83\u5bf9\u670d\u52a1\u7ec4\u4ef6\u7684\u521d\u59cb\u5316\u8fc7\u7a0b\u3002<\/p>\n<h3>\u4e09\u3001\u4ee3\u7801\u793a\u4f8b&#xff1a;\u670d\u52a1\u5668\u7ec4\u4ef6\u7684\u5b8c\u6574\u4f7f\u7528<\/h3>\n<p>\u4e0b\u9762\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7684\u4ee3\u7801\u793a\u4f8b&#xff0c;\u5c55\u793a\u5982\u4f55\u4f7f\u7528\u670d\u52a1\u5668\u7ec4\u4ef6\u6765\u7ba1\u7406Tomcat\u7684\u542f\u52a8\u548c\u5173\u95ed\u3002<\/p>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Connector<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Context<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Engine<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Host<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Service<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">Server<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>core<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">StandardContext<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>core<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">StandardEngine<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>core<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">StandardHost<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>core<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">StandardServer<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>connector<span class=\"token punctuation\">.<\/span>http<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">HttpConnector<\/span><\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">TomcatServerExample<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u521b\u5efaServer\u5b9e\u4f8b<\/span><br \/>\n        <span class=\"token class-name\">Server<\/span> server <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">StandardServer<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u8bbe\u7f6e\u5173\u95ed\u7aef\u53e3\u548c\u547d\u4ee4<\/span><br \/>\n        server<span class=\"token punctuation\">.<\/span><span class=\"token function\">setPort<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">8005<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        server<span class=\"token punctuation\">.<\/span><span class=\"token function\">setShutdown<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;SHUTDOWN&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u521b\u5efaService\u5b9e\u4f8b<\/span><br \/>\n        <span class=\"token class-name\">Service<\/span> service <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>apache<span class=\"token punctuation\">.<\/span>catalina<span class=\"token punctuation\">.<\/span>core<span class=\"token punctuation\">.<\/span><\/span>StandardService<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        server<span class=\"token punctuation\">.<\/span><span class=\"token function\">addService<\/span><span class=\"token punctuation\">(<\/span>service<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u521b\u5efaConnector\u5b9e\u4f8b<\/span><br \/>\n        <span class=\"token class-name\">Connector<\/span> connector <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">HttpConnector<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        service<span class=\"token punctuation\">.<\/span><span class=\"token function\">addConnector<\/span><span class=\"token punctuation\">(<\/span>connector<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u521b\u5efaEngine\u5b9e\u4f8b<\/span><br \/>\n        <span class=\"token class-name\">Engine<\/span> engine <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">StandardEngine<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        service<span class=\"token punctuation\">.<\/span><span class=\"token function\">setContainer<\/span><span class=\"token punctuation\">(<\/span>engine<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u521b\u5efaHost\u5b9e\u4f8b<\/span><br \/>\n        <span class=\"token class-name\">Host<\/span> host <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">StandardHost<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        host<span class=\"token punctuation\">.<\/span><span class=\"token function\">setName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;localhost&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        engine<span class=\"token punctuation\">.<\/span><span class=\"token function\">addChild<\/span><span class=\"token punctuation\">(<\/span>host<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u521b\u5efaContext\u5b9e\u4f8b<\/span><br \/>\n        <span class=\"token class-name\">Context<\/span> context <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">StandardContext<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        context<span class=\"token punctuation\">.<\/span><span class=\"token function\">setPath<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/myApp&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        host<span class=\"token punctuation\">.<\/span><span class=\"token function\">addChild<\/span><span class=\"token punctuation\">(<\/span>context<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u5c06Server\u4e0eConnector\u5173\u8054<\/span><br \/>\n        connector<span class=\"token punctuation\">.<\/span><span class=\"token function\">setContainer<\/span><span class=\"token punctuation\">(<\/span>engine<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u521d\u59cb\u5316\u5e76\u542f\u52a8Server<\/span><br \/>\n            server<span class=\"token punctuation\">.<\/span><span class=\"token function\">initialize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            server<span class=\"token punctuation\">.<\/span><span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u8ba9\u7a0b\u5e8f\u7b49\u5f85&#xff0c;\u6a21\u62df\u670d\u52a1\u5668\u8fd0\u884c<\/span><br \/>\n            <span class=\"token class-name\">Thread<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">sleep<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">60000<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u53d1\u9001\u5173\u95ed\u547d\u4ee4<\/span><br \/>\n            server<span class=\"token punctuation\">.<\/span><span class=\"token function\">await<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Exception<\/span> e<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            e<span class=\"token punctuation\">.<\/span><span class=\"token function\">printStackTrace<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d&#xff0c;\u6211\u4eec\u521b\u5efa\u4e86Server\u3001Service\u3001Connector\u3001Engine\u3001Host\u548cContext\u7b49\u7ec4\u4ef6&#xff0c;\u5e76\u914d\u7f6e\u4e86\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u901a\u8fc7\u8c03\u7528initialize()\u3001start()\u548cawait()\u65b9\u6cd5&#xff0c;\u5b9e\u73b0\u4e86\u670d\u52a1\u5668\u7684\u542f\u52a8\u3001\u8fd0\u884c\u548c\u5173\u95ed\u8fc7\u7a0b\u3002<\/p>\n<h3>\u56db\u3001\u77e5\u8bc6\u70b9\u603b\u7ed3<\/h3>\n<table>\n<tr>\u77e5\u8bc6\u70b9\u63cf\u8ff0<\/tr>\n<tbody>\n<tr>\n<td>\u670d\u52a1\u5668\u7ec4\u4ef6\u4f5c\u7528<\/td>\n<td>\u7edf\u4e00\u7ba1\u7406Tomcat\u7684\u542f\u52a8\u548c\u5173\u95ed&#xff0c;\u5305\u542b\u5176\u4ed6\u7ec4\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>Server\u63a5\u53e3\u65b9\u6cd5<\/td>\n<td>getShutdown()\u548csetShutdown(String shutdown)&#xff1a;\u83b7\u53d6\u548c\u8bbe\u7f6e\u5173\u95ed\u547d\u4ee4&#xff1b;getPort()\u548csetPort(int port)&#xff1a;\u83b7\u53d6\u548c\u8bbe\u7f6e\u5173\u95ed\u7aef\u53e3&#xff1b;addService(Service service)&#xff1a;\u6dfb\u52a0\u670d\u52a1\u7ec4\u4ef6&#xff1b;removeService(Service service)&#xff1a;\u5220\u9664\u670d\u52a1\u7ec4\u4ef6&#xff1b;findServices()&#xff1a;\u83b7\u53d6\u6240\u6709\u670d\u52a1\u7ec4\u4ef6&#xff1b;initialize()&#xff1a;\u7cfb\u7edf\u521d\u59cb\u5316&#xff1b;await()&#xff1a;\u7b49\u5f85\u5173\u95ed\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>StandardServer\u7c7b<\/td>\n<td>Server\u63a5\u53e3\u7684\u6807\u51c6\u5b9e\u73b0&#xff0c;\u5305\u542b\u5173\u95ed\u673a\u5236\u76f8\u5173\u65b9\u6cd5&#xff0c;\u5982initialize()\u3001start()\u3001stop()\u548cawait()<\/td>\n<\/tr>\n<tr>\n<td>\u4ee3\u7801\u793a\u4f8b<\/td>\n<td>\u5c55\u793a\u5982\u4f55\u521b\u5efa\u548c\u914d\u7f6e\u670d\u52a1\u5668\u7ec4\u4ef6&#xff0c;\u5b9e\u73b0Tomcat\u7684\u542f\u52a8\u3001\u8fd0\u884c\u548c\u5173\u95ed<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5199\u4f5c\u4e0d\u6613&#xff0c;\u5982\u679c\u8fd9\u7bc7\u535a\u5ba2\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u4e86Tomcat\u7684\u670d\u52a1\u5668\u7ec4\u4ef6\u548c\u670d\u52a1\u7ec4\u4ef6&#xff0c;\u8bf7\u5173\u6ce8\u6211\u7684\u535a\u5ba2&#xff0c;\u70b9\u8d5e\u5e76\u7559\u4e0b\u8bc4\u8bba\u3002\u4f60\u7684\u652f\u6301\u662f\u6211\u7ee7\u7eed\u521b\u4f5c\u7684\u52a8\u529b&#xff0c;\u8ba9\u6211\u4eec\u4e00\u8d77\u5728\u6280\u672f\u7684\u6d77\u6d0b\u4e2d\u63a2\u7d22\u524d\u884c&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb928\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u672c\u6587\u6df1\u5165\u5256\u6790Tomcat\u7684\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6\u5de5\u4f5c\u673a\u5236\u3002\u670d\u52a1\u5668\u7ec4\u4ef6\uff08Server\u63a5\u53e3\uff09\u4f5c\u4e3aTomcat\u7684\u6838\u5fc3\uff0c\u7edf\u4e00\u7ba1\u7406\u542f\u52a8\u548c\u5173\u95ed\u6d41\u7a0b\uff0c\u901a\u8fc7initialize()\u3001start()\u3001stop()\u7b49\u65b9\u6cd5\u63a7\u5236\u6240\u6709\u670d\u52a1\u7ec4\u4ef6\u3002StandardServer\u7c7b\u662f\u5176\u6807\u51c6\u5b9e\u73b0\uff0c\u8d1f\u8d23\u5173\u95ed\u673a\u5236\u548c\u7ec4\u4ef6\u521d\u59cb\u5316\u3002\u6587\u7ae0\u901a\u8fc7\u4ee3\u7801\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u914d\u7f6eServer\u3001Service\u3001Connector\u7b49\u7ec4\u4ef6\u7684\u5173\u7cfb\uff0c\u4ee5\u53ca\u542f\u52a8\u5173\u95ed\u6d41\u7a0b\u3002\u5173\u952e\u70b9\u5305\u62ec\uff1a\u670d\u52a1\u5668\u7ec4\u4ef6\u7684\u7edf\u4e00\u7ba1\u63a7\u80fd\u529b\u3001\u5173\u95ed\u7aef\u53e3\u8bbe\u7f6e\u3001\u670d\u52a1\u7ec4\u4ef6\u7ba1\u7406\u65b9\u6cd5\u7b49\uff0c\u4e3a\u7406\u89e3Tomcat\u5185\u90e8\u67b6\u6784\u63d0\u4f9b\u4e86\u6280\u672f\u53c2\u8003\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,223,43],"topic":[],"class_list":["post-41554","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-tomcat","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/41554.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb928\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u672c\u6587\u6df1\u5165\u5256\u6790Tomcat\u7684\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6\u5de5\u4f5c\u673a\u5236\u3002\u670d\u52a1\u5668\u7ec4\u4ef6\uff08Server\u63a5\u53e3\uff09\u4f5c\u4e3aTomcat\u7684\u6838\u5fc3\uff0c\u7edf\u4e00\u7ba1\u7406\u542f\u52a8\u548c\u5173\u95ed\u6d41\u7a0b\uff0c\u901a\u8fc7initialize()\u3001start()\u3001stop()\u7b49\u65b9\u6cd5\u63a7\u5236\u6240\u6709\u670d\u52a1\u7ec4\u4ef6\u3002StandardServer\u7c7b\u662f\u5176\u6807\u51c6\u5b9e\u73b0\uff0c\u8d1f\u8d23\u5173\u95ed\u673a\u5236\u548c\u7ec4\u4ef6\u521d\u59cb\u5316\u3002\u6587\u7ae0\u901a\u8fc7\u4ee3\u7801\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u914d\u7f6eServer\u3001Service\u3001Connector\u7b49\u7ec4\u4ef6\u7684\u5173\u7cfb\uff0c\u4ee5\u53ca\u542f\u52a8\u5173\u95ed\u6d41\u7a0b\u3002\u5173\u952e\u70b9\u5305\u62ec\uff1a\u670d\u52a1\u5668\u7ec4\u4ef6\u7684\u7edf\u4e00\u7ba1\u63a7\u80fd\u529b\u3001\u5173\u95ed\u7aef\u53e3\u8bbe\u7f6e\u3001\u670d\u52a1\u7ec4\u4ef6\u7ba1\u7406\u65b9\u6cd5\u7b49\uff0c\u4e3a\u7406\u89e3Tomcat\u5185\u90e8\u67b6\u6784\u63d0\u4f9b\u4e86\u6280\u672f\u53c2\u8003\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/41554.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-03T08:30:50+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/41554.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/41554.html\",\"name\":\"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-03T08:30:50+00:00\",\"dateModified\":\"2025-06-03T08:30:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/41554.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/41554.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/41554.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/41554.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb928\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u672c\u6587\u6df1\u5165\u5256\u6790Tomcat\u7684\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6\u5de5\u4f5c\u673a\u5236\u3002\u670d\u52a1\u5668\u7ec4\u4ef6\uff08Server\u63a5\u53e3\uff09\u4f5c\u4e3aTomcat\u7684\u6838\u5fc3\uff0c\u7edf\u4e00\u7ba1\u7406\u542f\u52a8\u548c\u5173\u95ed\u6d41\u7a0b\uff0c\u901a\u8fc7initialize()\u3001start()\u3001stop()\u7b49\u65b9\u6cd5\u63a7\u5236\u6240\u6709\u670d\u52a1\u7ec4\u4ef6\u3002StandardServer\u7c7b\u662f\u5176\u6807\u51c6\u5b9e\u73b0\uff0c\u8d1f\u8d23\u5173\u95ed\u673a\u5236\u548c\u7ec4\u4ef6\u521d\u59cb\u5316\u3002\u6587\u7ae0\u901a\u8fc7\u4ee3\u7801\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u914d\u7f6eServer\u3001Service\u3001Connector\u7b49\u7ec4\u4ef6\u7684\u5173\u7cfb\uff0c\u4ee5\u53ca\u542f\u52a8\u5173\u95ed\u6d41\u7a0b\u3002\u5173\u952e\u70b9\u5305\u62ec\uff1a\u670d\u52a1\u5668\u7ec4\u4ef6\u7684\u7edf\u4e00\u7ba1\u63a7\u80fd\u529b\u3001\u5173\u95ed\u7aef\u53e3\u8bbe\u7f6e\u3001\u670d\u52a1\u7ec4\u4ef6\u7ba1\u7406\u65b9\u6cd5\u7b49\uff0c\u4e3a\u7406\u89e3Tomcat\u5185\u90e8\u67b6\u6784\u63d0\u4f9b\u4e86\u6280\u672f\u53c2\u8003\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/41554.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-03T08:30:50+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/41554.html","url":"https:\/\/www.wsisp.com\/helps\/41554.html","name":"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-03T08:30:50+00:00","dateModified":"2025-06-03T08:30:50+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/41554.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/41554.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/41554.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6df1\u5165\u5256\u6790Tomcat\u4e4b\u670d\u52a1\u5668\u4e0e\u670d\u52a1\u7ec4\u4ef6"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/41554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=41554"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/41554\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=41554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=41554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=41554"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=41554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}