{"id":243,"date":"2021-11-09T14:39:39","date_gmt":"2021-11-09T06:39:39","guid":{"rendered":"https:\/\/fugary.com\/?p=243"},"modified":"2021-11-24T22:44:42","modified_gmt":"2021-11-24T14:44:42","slug":"intellij-idea%e8%bf%9c%e7%a8%8b%e8%b0%83%e8%af%95tomcat%e5%92%8cspring-boot%e9%a1%b9%e7%9b%ae","status":"publish","type":"post","link":"https:\/\/fugary.com\/?p=243","title":{"rendered":"Intellij IDEA\u8fdc\u7a0b\u8c03\u8bd5Tomcat\u548cSpring Boot\u9879\u76ee"},"content":{"rendered":"<p>\u6709\u65f6\u5019\u4f1a\u9047\u5230\u4e00\u4e9b<code>bug<\/code>\uff0c\u6d4b\u8bd5\u73af\u5883\u91cd\u73b0\u4e0d\u4e86\uff0c\u9700\u8981\u5728\u9884\u6f14\u6216\u8005\u751f\u4ea7\u4e0a\u624d\u51fa\u73b0\uff0c\u56e0\u6b64\u9700\u8981\u901a\u8fc7\u8fdc\u7a0b\u8c03\u8bd5\u65b9\u5f0f\u8fde\u63a5\u8fc7\u53bb\uff0c\u53ef\u4ee5\u5355\u6b65\u8c03\u8bd5\u95ee\u9898\u3002<\/p>\n<p>\u5355\u6b65\u8c03\u8bd5\u4f1a\u4e2d\u65ad\u5e76\u7b49\u5f85\uff0c\u5982\u679c\u662f\u751f\u4ea7\u95ee\u9898\uff0c\u53ef\u4ee5\u5355\u72ec\u518d\u542f\u52a8\u4e00\u4e2a\u751f\u4ea7\u4e00\u6837\u7684<code>JVM<\/code>\u505a\u6d4b\u8bd5\u3002<\/p>\n<h3>Tomcat\u914d\u7f6e<\/h3>\n<h4>\u542f\u52a8Tomcat\u8c03\u8bd5<\/h4>\n<p><code>Tomcat<\/code>\u9ed8\u8ba4\u652f\u6301\u5355\u6b65\u8c03\u8bd5\uff0c\u56e0\u6b64\u53ea\u9700\u8981\u5f00\u542f\u5373\u53ef\uff1a<\/p>\n<pre><code class=\"language-sh\"># Windows\ncatalina.bat jpda start\n# Linux\n.\/catalina.sh jpda start<\/code><\/pre>\n<p>\u5b9e\u9645Tomcat\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a<\/p>\n<pre><code class=\"language-sh\"># Tomcat\u4e2d\u914d\u7f6e\n-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%\n# \u5e38\u7528\u8c03\u8bd5\uff1a\njava -jar -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:8000,server=y,suspend=n xxx.jar<\/code><\/pre>\n<p>\u76f8\u5173bat\u6e90\u7801\uff1a<\/p>\n<pre><code class=\"language-sh\">if not &quot;&quot;%1&quot;&quot; == &quot;&quot;jpda&quot;&quot; goto noJpda\nset JPDA=jpda\nif not &quot;%JPDA_TRANSPORT%&quot; == &quot;&quot; goto gotJpdaTransport\nset JPDA_TRANSPORT=dt_socket\n:gotJpdaTransport\nif not &quot;%JPDA_ADDRESS%&quot; == &quot;&quot; goto gotJpdaAddress\nset JPDA_ADDRESS=localhost:8000\n:gotJpdaAddress\nif not &quot;%JPDA_SUSPEND%&quot; == &quot;&quot; goto gotJpdaSuspend\nset JPDA_SUSPEND=n\n:gotJpdaSuspend\nif not &quot;%JPDA_OPTS%&quot; == &quot;&quot; goto gotJpdaOpts\nset JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%\n:gotJpdaOpts\nshift\n:noJpda<\/code><\/pre>\n<h4>\u81ea\u5b9a\u4e49Tomcat\u8c03\u8bd5\u53c2\u6570<\/h4>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code>Tomcat<\/code>\u8c03\u8bd5\u53c2\u6570\u76d1\u63a7\uff1a<code>localhost:8000<\/code><\/p>\n<p>\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49\uff0c\u53ef\u4ee5\u53e6\u5916\u7f16\u5199\u4e00\u4e2a<code>bat<\/code>\/sh\u6587\u4ef6\uff0c\u6216\u8005\u4fee\u6539<code>catalina.bat<\/code>\u6587\u4ef6\uff0c\u6dfb\u52a0<\/p>\n<pre><code class=\"language-sh\"># \u81ea\u5b9a\u4e49\u7aef\u53e3\nset JPDA_ADDRESS=localhost:8001\n# \u4e0a\u9762\u8fd9\u79cd\u914d\u7f6e\u53ea\u80fdlocalhost\u8bbf\u95ee\uff0c\u8fdc\u7a0b\u8bbf\u95ee\u4e00\u822c\u90fd\u4e0d\u5728\u81ea\u5df1\u7684\u673a\u5668\u4e0a\uff0c\u9700\u8981\u914d\u7f6e\u6210\uff1a\nset JPDA_ADDRESS=0.0.0.0:8001<\/code><\/pre>\n<h3>Intellij IDEA\u8fdc\u7a0b\u8c03\u8bd5<\/h3>\n<p>\u5728IDEA\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u8fd0\u884c\u914d\u7f6e\uff0c\u9009\u62e9\u3010Remote JVM Debug\u3011\uff1a<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143757.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143757.png\" alt=\"\" \/><\/div><\/p>\n<p>\u914d\u7f6e\u8fdc\u7a0bTomcat\u76d1\u542c\u7684\u5730\u5740\uff1a<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143814.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143814.png\" alt=\"\" \/><\/div><\/p>\n<p>\u8fde\u63a5\u6210\u529f\u4e4b\u540e\u53ef\u4ee5\u770b\u5230\u63d0\u793a\u4fe1\u606f\uff1a<\/p>\n<blockquote>\n<p>Connected to the target VM, address: 'localhost:8000', transport: 'socket'<\/p>\n<\/blockquote>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143819.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143819.png\" alt=\"\" \/><\/div><\/p>\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u6253\u4e0a\u65ad\u70b9\uff0c\u5355\u6b65\u8c03\u8bd5\u4e86\u3002<\/p>\n<h3>Spring Boot\u5de5\u7a0b\u8fdc\u7a0b\u914d\u7f6e<\/h3>\n<p>\u5fae\u670d\u52a1\u4e00\u822c\u901a\u8fc7jar\u5305\u542f\u52a8\uff0c\u56e0\u6b64\u5728jar\u5305\u542f\u52a8\u53c2\u6570\u4e2d\u6dfb\u52a0<\/p>\n<pre><code class=\"language-sh\">java -jar -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:8000,server=y,suspend=n master-service-provider.jar\n# \u53ef\u4ee5\u770b\u5230\u8f93\u51fa\u5c31\u53ef\u4ee5\u4e86\uff0c\u6ce8\u610f\uff0cjar\u5305\u53c2\u6570\u8981\u5728\u6700\u540e\n# Listening for transport dt_socket at address: 8000<\/code><\/pre>\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u901a\u8fc7<code>Idea<\/code>\u94fe\u63a5\u8fc7\u53bb\u4e86\uff0c\u548c<code>Tomcat<\/code>\u5de5\u7a0b\u8fde\u63a5\u65b9\u5f0f\u4e00\u6837\u3002<\/p>\n<p><div class='fancybox-wrapper' data-fancybox='post-images' href='https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143824.png'><img src=\"https:\/\/git.mengqingpo.com:8888\/fugary\/blogpic1\/-\/raw\/master\/images\/20211109143824.png\" alt=\"image-20211109142847209\" \/><\/div><\/p>\n<p>\u770b\u5230\u8fde\u63a5\u6210\u529f\u7684\u6d88\u606f\u5c31\u53ef\u4ee5\u8c03\u8bd5\u4e86\u3002<\/p>\n<pre><code>Connected to the target VM, address: &#039;localhost:8000&#039;, transport: &#039;socket&#039;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u65f6\u5019\u4f1a\u9047\u5230\u4e00\u4e9bbug\uff0c\u6d4b\u8bd5\u73af\u5883\u91cd\u73b0\u4e0d\u4e86\uff0c\u9700\u8981\u5728\u9884\u6f14\u6216\u8005\u751f\u4ea7\u4e0a\u624d\u51fa\u73b0\uff0c\u56e0\u6b64\u9700\u8981\u901a\u8fc7\u8fdc\u7a0b\u8c03\u8bd5\u65b9\u5f0f\u8fde\u63a5\u8fc7\u53bb\uff0c\u53ef\u4ee5\u5355 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,2],"tags":[],"_links":{"self":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/243"}],"collection":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=243"}],"version-history":[{"count":2,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":249,"href":"https:\/\/fugary.com\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions\/249"}],"wp:attachment":[{"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fugary.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}