{"id":2326,"date":"2017-03-07T13:14:02","date_gmt":"2017-03-07T11:14:02","guid":{"rendered":"http:\/\/hasselba.ch\/blog\/?p=2326"},"modified":"2017-03-08T11:02:05","modified_gmt":"2017-03-08T09:02:05","slug":"domin-rest-debug-your-plugin","status":"publish","type":"post","link":"https:\/\/hasselba.ch\/blog\/?p=2326","title":{"rendered":"Domino &#038; REST: Debug your Plugin"},"content":{"rendered":"<p>When developing OSGi Plugins, you should have your own development server running on your local machine. Not only because of the faster deployment of changes (a new version of a plugin must always deployed with a HTTP restart), but because of the Java debugging posibilities: Only one Eclipse instance can connect to the JVM, and every request processed by the server will start the debugger. If multiple users a accessing the server while you are debugging, your Eclipse will try to debug every incoming request, and this can lead into a confusing situation for all.<\/p>\n<p>To enable debugging, you first have to add two parameters to the <em>notes.ini<\/em>:<\/p>\n<pre><code>JavaEnableDebug=1\r\nJavaDebugOptions=transport=dt_socket,server=y,suspend=n,address=8000<\/code><\/pre>\n<p>This starts the debugging on port 8000. Feel free to change the value to every port you want. Because of security reasons you should not start debugging on a productive machine.<\/p>\n<p>After restarting the domino server, you can connect to the JVM in your Eclipse IDE by creating a new JVM remote debugging session. Create a new debug configuration&#8230;<\/p>\n<p><a href=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_44_17-Java-Eclipse.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2337\" src=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_44_17-Java-Eclipse.png\" alt=\"\" width=\"270\" height=\"133\" \/><\/a><\/p>\n<p>&#8230; choose (1) &#8222;<em>Remote Java Application<\/em>&#8222;, (2) give a name to it, (3) select the plugin project, (4) enter the port the server listens, and click on (5) &#8222;<em>Apply<\/em>&#8222;.<\/p>\n<p><a href=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_53_30-Java-Eclipse-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2340\" src=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_53_30-Java-Eclipse-1.png\" alt=\"\" width=\"862\" height=\"537\" srcset=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_53_30-Java-Eclipse-1.png 862w, https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_53_30-Java-Eclipse-1-300x187.png 300w, https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_53_30-Java-Eclipse-1-768x478.png 768w\" sizes=\"auto, (max-width: 862px) 100vw, 862px\" \/><\/a><\/p>\n<p>If you want to connect to your server, you need to start debugging by clicking on the project:<\/p>\n<p><a href=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_36_02-Java-Eclipse.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2341\" src=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/2017-03-06-09_36_02-Java-Eclipse.png\" alt=\"\" width=\"221\" height=\"129\" \/><\/a><\/p>\n<p>After setting a breakpoint and sending a request to the servlet, Eclipse switches to the Debug perspective where you can look what happens with your servlet.<\/p>\n<p><a href=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/Eclipse-debugger.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2344\" src=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/Eclipse-debugger.png\" alt=\"\" width=\"491\" height=\"485\" srcset=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/Eclipse-debugger.png 491w, https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2017\/03\/Eclipse-debugger-300x296.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><\/p>\n<p>Sometimes you are connecting to the &#8222;wrong&#8220; JVM, because a Java agent is running and\/or a DOTS task does it&#8217;s job. It&#8217;s better to disable these tasks on your development server.<\/p>\n<p>During debugging you are able to <a href=\"https:\/\/wiki.eclipse.org\/FAQ_What_is_hot_code_replace%3F\" target=\"_blank\">hotswap your code<\/a>, but keep in mind that after a restart of the HTTP JVM all your changes are no longer &#8222;installed&#8220;. You have to build a new plugin or replace your code during runtime again.<\/p>\n<p>In the next blog post, let&#8217;s talk about our development tools.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When developing OSGi Plugins, you should have your own development server running on your local machine. Not only because of the faster deployment of changes (a new version of a plugin must always deployed with a HTTP restart), but because &hellip; <a href=\"https:\/\/hasselba.ch\/blog\/?p=2326\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[114,89,116,64,61],"tags":[118,7,115,31,65,60,16],"class_list":["post-2326","post","type-post","status-publish","format-standard","hentry","category-jackson","category-java","category-jee","category-osgi","category-rest","tag-apache-wink","tag-domino","tag-jackson","tag-java","tag-osgi","tag-rest","tag-server"],"_links":{"self":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2326"}],"version-history":[{"count":10,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2326\/revisions"}],"predecessor-version":[{"id":2352,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2326\/revisions\/2352"}],"wp:attachment":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}