{"id":9,"date":"2016-04-05T00:16:37","date_gmt":"2016-04-05T00:16:37","guid":{"rendered":"http:\/\/topshot.com\/blog\/?p=7"},"modified":"2016-04-05T12:53:19","modified_gmt":"2016-04-05T16:53:19","slug":"creating-a-json-based-web-server-eclipse-project-2","status":"publish","type":"post","link":"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/","title":{"rendered":"Creating a JSON-based Web Server Eclipse Project"},"content":{"rendered":"<p>With the current work I am doing for our client as a consultant, I have not had any recent opportunity to work with or let alone, configure a Spring framework.\u00a0 Realizing that I was getting a bit rusty and that Spring 4 had come out since I last worked with Spring, I thought it best to spend a little extra time reviewing Spring by putting together a simple server environment using Spring and JSON (which is a application popular protocol for use with client software).\u00a0 I thought this should only take a couple of hours at most.\u00a0 I figured the latest Eclipse would have everything built-in and it would be just a matter of creating a few application classes.<\/p>\n<p>Eclipse can indeed create a client\/server project but I saw no sample code for creating JSON controllers. I knew it was just a matter of defining a few annotation items but I had forgotten which ones I needed and their particular syntax.\u00a0 Solution: go to the Internet and search for &#8220;json eclipse server example&#8221;.\u00a0 I found a number of tutorial sites that included downloadable projects.\u00a0 I tried three of them.\u00a0 None of them worked out of the box.\u00a0 I found this particularly surprising as there were comments and thanks from users who had found the tutorials very useful and presumably had used the downloadable code.\u00a0 I assumed the issue was versioning and so I set out to grab the latest and greatest of everything (at least as of the date that I am writing this article). \u00a0Building with these versions, too, wasn&#8217;t as obvious as it should have been. One of the library names had changed. But with a little perseverance, I finally hit on the correct versions of libraries that I needed to produce a functional JSON-based web server project.<\/p>\n<p>The details are described below.\u00a0 Note that this article is not meant to be a tutorial on JSON.\u00a0 It is simply meant to be informative information for quickly getting a JSON-based web server project up and running.<\/p>\n<h2>Install Java 8<\/h2>\n<p>I should really be assuming that you have the JDK version of Java 8 installed. How do you expect to develop any software without it?\u00a0 Nevertheless, if you have Java 6 or Java 7 installed, realize that they are no longer supported. You really need to upgrade to Java 8.\u00a0 Here&#8217;s a link to the latest Java download page:\u00a0 <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html\">http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html<\/a>.\u00a0 \u00a0You can have more than one version of Java installed at the same time.\u00a0 Just set your PATH and JAVA_HOME variables to the appropriate version.<\/p>\n<h2>Install Tomcat 8<\/h2>\n<p>Tomcat is one of the easiest application servers to install, configure and run.\u00a0 There are other similarly good app servers but this is the one I chose to use.\u00a0 The latest version of tomcat is version 9 but it&#8217;s really very new (and I don&#8217;t know what features it has above and beyond version 8) and so I chose to install version 8.\u00a0 Download tomcat from here: <a href=\"https:\/\/tomcat.apache.org\/download-80.cgi\">https:\/\/tomcat.apache.org\/download-80.cgi<\/a>.\u00a0 I usually download the zip file onto my Windows box and install it in a local directory called util (this is where I drop all my Apache software after downloading the respective zip files).\u00a0 So if my user name is &#8216;jberry&#8217;, I will end up with a directory called jberry\/util\/apache-tomcat-8.0.32.<\/p>\n<h2>Install Eclipse<\/h2>\n<p>Install the latest version of eclipse.\u00a0 Go to the eclipse download page:\u00a0 <a href=\"https:\/\/eclipse.org\/downloads\/\">https:\/\/eclipse.org\/downloads\/<\/a>.\u00a0 I suggest installing &#8220;Eclipse IDE for Java EE Developers&#8221;.\u00a0 This gives you all the tools you might need for developing your web-based application.\u00a0 The download file will be a zip file.\u00a0 I unzipped everything into folder jberry\/eclipse.\u00a0 To execute eclipse, go to directory jberry\/eclipse\/jee-mars\/eclipse.\u00a0 There you will find the executable file, eclipse.exe.<\/p>\n<h2>Workspace setup<\/h2>\n<p>Create a directory called jberry\/workspace (or wherever you want).\u00a0 Download the zip file that includes my source code for the JSON example.\u00a0 The link is here: <a href=\"https:\/\/dl.dropboxusercontent.com\/u\/14719415\/RecordCollection.zip\">https:\/\/dl.dropboxusercontent.com\/u\/14719415\/RecordCollection.zip<\/a>.<\/p>\n<h2>Eclipse startup<\/h2>\n<p>Start eclipse.\u00a0 It will ask you for the location of your workspace.\u00a0 Enter the workspace path from the previous step.\u00a0 After a brief moment, you will see an eclipse window entitled &#8220;Eclipse Java EE IDE for Web Developers&#8221;.\u00a0 In the upper right corner, press the button &#8220;Workbench&#8221;.<\/p>\n<p>From the top pulldown menu, click on WIndow &#8211;&gt; Preferences.\u00a0 By the left side of the window, find Java, expand the arrow and click on Installed JREs, as shown here:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"22\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/installjava-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/InstallJava-2.jpg?fit=333%2C441&amp;ssl=1\" data-orig-size=\"333,441\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"InstallJava\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/InstallJava-2.jpg?fit=227%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/InstallJava-2.jpg?fit=333%2C441&amp;ssl=1\" class=\"alignnone size-medium wp-image-22\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/InstallJava-2-227x300.jpg?resize=227%2C300\" alt=\"InstallJava\" width=\"227\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/InstallJava-2.jpg?resize=227%2C300&amp;ssl=1 227w, https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/InstallJava-2.jpg?w=333&amp;ssl=1 333w\" sizes=\"auto, (max-width: 227px) 85vw, 227px\" \/><\/p>\n<p>Click on the &#8220;Add&#8221; button and find the path where your Java 8 JDK was installed.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"18\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/jdk\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/jdk-2.jpg?fit=602%2C118&amp;ssl=1\" data-orig-size=\"602,118\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"jdk\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/jdk-2.jpg?fit=300%2C59&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/jdk-2.jpg?fit=602%2C118&amp;ssl=1\" class=\"alignnone size-full wp-image-18\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/jdk-2.jpg?resize=602%2C118\" alt=\"jdk\" width=\"602\" height=\"118\" srcset=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/jdk-2.jpg?w=602&amp;ssl=1 602w, https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/jdk-2.jpg?resize=300%2C59&amp;ssl=1 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<p>Press the &#8220;Apply&#8221; button.<\/p>\n<h2>Setup tomcat within eclipse<\/h2>\n<p>In the same preferences window, at the left side of the window, find &#8220;Server&#8221;, open it up and click on Runtime Environments:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"20\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/runtime\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/runtime-1.jpg?fit=191%2C208&amp;ssl=1\" data-orig-size=\"191,208\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"runtime\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/runtime-1.jpg?fit=191%2C208&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/runtime-1.jpg?fit=191%2C208&amp;ssl=1\" class=\"alignnone size-full wp-image-20\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/runtime-1.jpg?resize=191%2C208\" alt=\"runtime\" width=\"191\" height=\"208\" \/><\/p>\n<p>Press the &#8220;Add&#8221; button you will see a list of servers.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"15\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/apache\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/apache-1.jpg?fit=313%2C337&amp;ssl=1\" data-orig-size=\"313,337\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"apache\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/apache-1.jpg?fit=279%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/apache-1.jpg?fit=313%2C337&amp;ssl=1\" class=\"alignnone size-full wp-image-15\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/apache-1.jpg?resize=313%2C337\" alt=\"apache\" width=\"313\" height=\"337\" srcset=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/apache-1.jpg?w=313&amp;ssl=1 313w, https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/apache-1.jpg?resize=279%2C300&amp;ssl=1 279w\" sizes=\"auto, (max-width: 313px) 85vw, 313px\" \/><\/p>\n<p>Select Apache Tomcat v8.0 and click on &#8220;Next&gt;&#8221;.\u00a0 Do not check the box that says Create a new local server.\u00a0\u00a0 Click on the &#8220;Browse&#8221; button and find where you installed tomcat.\u00a0 Enter that path.\u00a0 Under JRE, click on &#8220;Workbench default JRE&#8221; and specify your JDK install.\u00a0 Your window should look something like this:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"21\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/tomcat\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/tomcat-1.jpg?fit=486%2C416&amp;ssl=1\" data-orig-size=\"486,416\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"tomcat\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/tomcat-1.jpg?fit=300%2C257&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/tomcat-1.jpg?fit=486%2C416&amp;ssl=1\" class=\"alignnone size-full wp-image-21\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/tomcat-1.jpg?resize=486%2C416\" alt=\"tomcat\" width=\"486\" height=\"416\" srcset=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/tomcat-1.jpg?w=486&amp;ssl=1 486w, https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/tomcat-1.jpg?resize=300%2C257&amp;ssl=1 300w\" sizes=\"auto, (max-width: 486px) 85vw, 486px\" \/><\/p>\n<p>Press &#8220;OK&#8221; to close your window.<\/p>\n<p>At the bottom of the eclipse window, click on the &#8220;Servers&#8221; tab, right-click and select &#8220;New Server&#8221;. A window similar to the follow should pop up.\u00a0 Press &#8220;Finish&#8221; to create the server.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"19\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/newserver\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/newserver-1.jpg?fit=501%2C614&amp;ssl=1\" data-orig-size=\"501,614\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"newserver\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/newserver-1.jpg?fit=245%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/newserver-1.jpg?fit=501%2C614&amp;ssl=1\" class=\"alignnone size-full wp-image-19\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/newserver-1.jpg?resize=501%2C614\" alt=\"newserver\" width=\"501\" height=\"614\" srcset=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/newserver-1.jpg?w=501&amp;ssl=1 501w, https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/newserver-1.jpg?resize=245%2C300&amp;ssl=1 245w\" sizes=\"auto, (max-width: 501px) 85vw, 501px\" \/><\/p>\n<h2>Import the JSON project<\/h2>\n<p>Click on &#8220;File&#8221; from the top pulldown menu and select &#8220;Import&#8230;&#8221;.\u00a0 Open category General and select &#8220;Existing Projects into Workspace&#8221; and press &#8220;Next&gt;&#8221;.\u00a0 Press the &#8220;Browse&#8230;&#8221; button and select the workspace directory that was defined above.\u00a0 You should see an Import Projects dialog box like this one:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"16\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/importprojects\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/importprojects-1.jpg?fit=507%2C611&amp;ssl=1\" data-orig-size=\"507,611\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"importprojects\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/importprojects-1.jpg?fit=249%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/importprojects-1.jpg?fit=507%2C611&amp;ssl=1\" class=\"alignnone size-full wp-image-16\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/importprojects-1.jpg?resize=507%2C611\" alt=\"importprojects\" width=\"507\" height=\"611\" srcset=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/importprojects-1.jpg?w=507&amp;ssl=1 507w, https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/importprojects-1.jpg?resize=249%2C300&amp;ssl=1 249w\" sizes=\"auto, (max-width: 507px) 85vw, 507px\" \/><\/p>\n<p>Click on the &#8220;Finish&#8221; button.<\/p>\n<p>Select the &#8220;Markers&#8221; tab at the bottom of eclipse.\u00a0 There should not be any Java errors. If there are errors, right-click on &#8220;RecordCollection&#8221; which should appear in the Project Explorer view (far left side of eclipse) and select &#8220;Maven&#8221; &#8211;&gt; &#8220;Update Project&#8230;&#8221;.<\/p>\n<h2>Description of the project<\/h2>\n<p>The data objects, Artist, Cd, and RegistrationInfo are straight-forward and are defined in package com.topshot.recordcolleciton.model.\u00a0 The two classes, ArtistInfo and CdInfo, are meant to simulate a simple database get or fetch operation but just returned hard-coded values.<\/p>\n<p>The interesting stuff takes place in the controller package. Note how @RequestMapping, both at the class level and the method level are used to define which method is to be executed see the section called Testing below).\u00a0 And most of all, note that there is no JSON conversion code in the application. Conversion of the various output classes is handled invisibly via Spring and its support libraries.\u00a0 Simply adding<em> produces=&#8221;application\/json&#8221;<\/em> tells Spring to perform this magic.<\/p>\n<h2>Run the project<\/h2>\n<p>Select the &#8220;Servers&#8221; tab at the bottom of eclipse.\u00a0 Then right-click on the tomcat instance and select &#8220;Start&#8221;.\u00a0 After a moment or so, tomcat will show that it is started and synchronized.\u00a0 This can be verified by opening the console tab.\u00a0 You should see something like this:<\/p>\n<p><span style=\"color: #ff9900;\">INFO: Server startup in 10395 ms<\/span><\/p>\n<p>Go back to the server tab and right-click on the server.\u00a0 Select &#8220;Add and Remove&#8230;&#8221;.\u00a0 Select the RecordCollection resource and press the &#8220;Add&gt;&#8221; button.\u00a0 Your dialog window should look something like this:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14\" data-permalink=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/addremove\/\" data-orig-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/addremove-1.jpg?fit=516%2C539&amp;ssl=1\" data-orig-size=\"516,539\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"addremove\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/addremove-1.jpg?fit=287%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/addremove-1.jpg?fit=516%2C539&amp;ssl=1\" class=\"alignnone size-full wp-image-14\" src=\"https:\/\/i0.wp.com\/topshot.com\/computermoose\/wp-content\/uploads\/2016\/04\/addremove-1.jpg?resize=516%2C539\" alt=\"addremove\" width=\"516\" height=\"539\" srcset=\"https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/addremove-1.jpg?w=516&amp;ssl=1 516w, https:\/\/i0.wp.com\/computermoose.topshot.com\/wp-content\/uploads\/2016\/04\/addremove-1.jpg?resize=287%2C300&amp;ssl=1 287w\" sizes=\"auto, (max-width: 516px) 85vw, 516px\" \/><\/p>\n<p>Personally, I always uncheck the box that says &#8220;If server is started, publish changes immediately&#8221;. But that&#8217;s up to you.\u00a0 The pluses and minuses of this choice are best saved for a more detailed discussion on software development and debugging.\u00a0 Press &#8220;Finish&#8221;.<\/p>\n<h2>Testing<\/h2>\n<p>Open a browser and enter URL <a href=\"http:\/\/localhost:8080\/RecordCollection\/Records\/artists\">http:\/\/localhost:8080\/RecordCollection\/Records\/artists<\/a>.\u00a0 You should get back the following line:<\/p>\n<p><span style=\"color: #ff9900;\">[{&#8220;name&#8221;:&#8221;Bob Dylan&#8221;},{&#8220;name&#8221;:&#8221;John Prine&#8221;},{&#8220;name&#8221;:&#8221;Joan Baez&#8221;},{&#8220;name&#8221;:&#8221;Leonard Cohen&#8221;}]<\/span><\/p>\n<p>Now enter <a href=\"http:\/\/localhost:8080\/RecordCollection\/Records\/cd\/CD2\">http:\/\/localhost:8080\/RecordCollection\/Records\/cd\/CD2<\/a> and\u00a0 you should get back the following line:<\/p>\n<p><span style=\"color: #ff9900;\">{&#8220;title&#8221;:&#8221;CD2&#8243;,&#8221;artist&#8221;:[{&#8220;name&#8221;:&#8221;John Prine&#8221;},{&#8220;name&#8221;:&#8221;Joan Baez&#8221;}],&#8221;song&#8221;:null}<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>In both of the above cases, you were executing HTTP GET commands.\u00a0 In order to execute an HTTP PUT command, a little more setup work is needed.\u00a0 There are many tools available that will generate a PUT command.\u00a0 One such tool is SoapUI.\u00a0 Configuring SoapUI is beyond the scope of this article.\u00a0 See the file README.txt which is part of the RecordCollection project for a little more information on testing PUTs.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the current work I am doing for our client as a consultant, I have not had any recent opportunity to work with or let alone, configure a Spring framework.\u00a0 Realizing that I was getting a bit rusty and that Spring 4 had come out since I last worked with Spring, I thought it best &hellip; <a href=\"https:\/\/computermoose.topshot.com\/index.php\/2016\/04\/05\/creating-a-json-based-web-server-eclipse-project-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Creating a JSON-based Web Server Eclipse Project&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-9","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7qelO-9","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":6,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"predecessor-version":[{"id":29,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts\/9\/revisions\/29"}],"wp:attachment":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}