{"id":410,"date":"2025-02-15T20:38:44","date_gmt":"2025-02-15T20:38:44","guid":{"rendered":"https:\/\/www.aran.cat\/wp\/?p=410"},"modified":"2025-02-22T10:59:55","modified_gmt":"2025-02-22T10:59:55","slug":"step-by-step-restful-web-service-example-in-java-using-eclipse-and-tomee-plus","status":"publish","type":"post","link":"https:\/\/www.aran.cat\/wp\/?p=410","title":{"rendered":"Step-by-step RESTful web service example in Java using Eclipse and TomEE Plus"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.techtarget.com\/contributor\/Cameron-McKenzie\">Cameron McKenzie<\/a>,&nbsp;TechTarget<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Published:&nbsp;<strong>01 Jan 2019<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Related Videos<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Use-Tomcat-Eclipse-to-create-a-JAX-RS-REST-web-service\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Use-Tomcat-Eclipse-to-create-a-JAX-RS-REST-web-service\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Use-Tomcat-Eclipse-to-create-a-JAX-RS-REST-web-service\">Use Tomcat, Eclipse to create a JAX-RS REST web service<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-SOAP-web-services-example-in-Java-using-Eclipse\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-SOAP-web-services-example-in-Java-using-Eclipse\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-SOAP-web-services-example-in-Java-using-Eclipse\">Step-by-step SOAP web services example in Java using Eclipse<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Tomcat-vs-Apache-HTTP-Server-Whats-the-difference\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Tomcat-vs-Apache-HTTP-Server-Whats-the-difference\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Tomcat-vs-Apache-HTTP-Server-Whats-the-difference\">Tomcat vs. Apache HTTP Server: What&#8217;s the difference?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Tomcat-vs-JBoss-Compare-features-of-these-Java-app-servers\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Tomcat-vs-JBoss-Compare-features-of-these-Java-app-servers\"><\/a><a href=\"https:\/\/www.theserverside.com\/video\/Tomcat-vs-JBoss-Compare-features-of-these-Java-app-servers\">Tomcat vs. JBoss: Compare features of these Java app servers<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.theserverside.com\/videos\">View All Videos<\/a><\/li>\n<\/ul>\n\n\n\n<ul id=\"social-icons-desktop\" class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-RESTful-web-service-example-in-Java-using-Eclipse#\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-RESTful-web-service-example-in-Java-using-Eclipse#\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-RESTful-web-service-example-in-Java-using-Eclipse#\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-RESTful-web-service-example-in-Java-using-Eclipse?vgnextfmt=print\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><a href=\"mailto:?subject=Step-by-step%20RESTful%20web%20service%20example%20in%20Java%20using%20Eclipse%20and%20TomEE%20Plus%20|%20TheServerSide&amp;body=https:\/\/www.theserverside.com\/video\/Step-by-step-RESTful-web-service-example-in-Java-using-Eclipse\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/embed\/Tpr4UfkX9e4\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/www.youtube.com\/embed\/Tpr4UfkX9e4<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">TheServerSide has published a number of articles on the tenets of&nbsp;<a href=\"https:\/\/www.theserverside.com\/video\/A-RESTful-APIs-tutorial-Learn-key-web-service-design-principles\">effective RESTful web service design<\/a>, along with examples of how to actually create a&nbsp;<a href=\"https:\/\/www.theserverside.com\/video\/Step-by-step-Spring-Boot-RESTful-web-services-example-in-Java\">cloud-native application using Spring Boot<\/a>&nbsp;and Spring Data APIs. In this JAX-RS tutorial, we will go back to basics by developing the exact same application, except this time we&#8217;ll use standard Java EE APIs and the extended, enterprise version of Tomcat, TomEE Plus, as our deployment target. This step-by-step JAX-RS RESTful web service example in Java using Eclipse and TomEE Plus will get you up to speed on modern web service development techniques in less than 15 minutes.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This tutorial uses Eclipse Oxygen as the development environment, the underlying JDK is at version 1.8, and the deployment target is TomEE Plus. You can&nbsp;<a href=\"http:\/\/tomee.apache.org\/apache-tomee.html\">download TomEE Plus<\/a>&nbsp;from the project&#8217;s Apache home page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Why are we using TomEE Plus, and not Tomcat or the standard TomEE offering? Sadly, the basic Java web profile, which Tomcat 9 implements, does not support JAX-RS, it does not include the javax.ws.rs.* packages, and without playing with POM files or adding JAR files to the Eclipse project&#8217;s&nbsp;\\lib&nbsp;directory, RESTful web services simply won&#8217;t work. The standard TomEE offering doesn&#8217;t include JAX-RS libraries either. On the other hand, the TomEE Plus server does include various enterprise packages, including JAX-RS, so RESTful web services will deploy right out of the box, making this RESTful web services example much simpler.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: The dynamic web project<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The first step in this JAX-RS tutorial is to kick off the dynamic web project creation wizard in Eclipse.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.theserverside.com\/rms\/editorial\/082218_JAX-RS_project_creation_half_column_mobile.png\" alt=\"JAX-RS project creation\"\/><figcaption class=\"wp-element-caption\">This JAX-RS tutorial utilizes a dynamic web project in Eclipse.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When the dynamic web project wizard appears, name the project&nbsp;<em>restful-java<\/em>, choose Apache Tomcat 8.5 as the target runtime (even though we are using TomEE Plus, not Tomcat), specify 3.1 as the dynamic web module version and choose a minimal configuration for the project. When these options are set, click Finish.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note that you need to install TomEE Plus prior to doing this JAX-RS tutorial. You can also use any other application server that supports Java EE and JAX-RS for this RESTful web service example in Java using Eclipse.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where is the web.xml file?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you look at this project in GitHub (link below), you&#8217;ll notice that there isn&#8217;t a web.xml file. That makes traditional enterprise developers nervous, but so long as everything is annotated, there&#8217;s no need for one in version 3.x of the Servlet and JSP spec. In older REST implementations you would need to configure a Jersey Servlet and perform a REST Servlet mapping, but that is no longer necessary. In this case, TomEE Plus will process all of the annotations on the classes in the Java web project and make RESTful web sevices available accordingly. It should be noted that on some servers, you do need to reference your JAX-RS classes explicility, which you can do through an Application class. That process is addressed in the JAX-RS problems section towards the end.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.theserverside.com\/rms\/editorial\/082218_JAX-RS_project_settings_half_column_mobile.png\" alt=\"JAX-RS project settings\"\/><figcaption class=\"wp-element-caption\">Specify project settings for the RESTful web service example in Java using Eclipse.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Create the&nbsp;Score&nbsp;class<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This restful web service example in Java using Eclipse models a score counter for an&nbsp;<a href=\"https:\/\/www.theserverside.com\/tutorial\/Tutorial-Coding-a-simple-Rock-Paper-Scissors-application-in-JavaScript\">online rock-paper-scissors application<\/a>, so the first requirement is to create a class named&nbsp;Score&nbsp;that keeps track of wins, losses and ties.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">package com.mcnz.restful.java.example;<br>public class Score {<br>&nbsp;&nbsp;&nbsp;&nbsp; public static int <em>WINS<\/em>, <em>LOSSES<\/em>, <em>TIES<\/em>;<br>}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To keep things simple, we won&#8217;t add any setters or getters. Furthermore, we are going to make the properties of the&nbsp;Score&nbsp;class static, as that will enable the Java virtual machine (<a href=\"https:\/\/www.theserverside.com\/definition\/Java-virtual-machine-JVM\">JVM<\/a>) to simulate persistence between stateless calls to the web service. This approach will enable us to run and test the application&nbsp;<a href=\"https:\/\/www.theserverside.com\/blog\/Coffee-Talk-Java-News-Stories-and-Opinions\/How-to-fix-the-Eclipse-No-Java-virtual-machine-was-found-install-error\">on a single JVM<\/a>. However, you should manage application state in this way only as a proof of concept. It&#8217;s better to persist data with&nbsp;<a href=\"https:\/\/www.theserverside.com\/tip\/How-JPA-and-Hibernate-simplify-data-persistence\">Hibernate and Java Persistence API<\/a>&nbsp;or save information to a NoSQL database, but that is beyond the scope of this JAX-RS tutorial.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Code the JAX-RS&nbsp;Service&nbsp;class<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A class named&nbsp;ScoreService&nbsp;is the heart and soul of this RESTful web service example in Java using Eclipse. As such, decorate it with an&nbsp;ApplicationPath&nbsp;annotation that defines the base URL of the web service.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">package com.mcnz.restful.java.example;<br>import javax.ws.rs.*;<br>&nbsp;<br>@ApplicationPath(\"\/\")<br>public class ScoreService {&nbsp; }<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This class will contain three getter methods that enable RESTful web clients to query the number of wins, losses or ties. These methods&nbsp;<a href=\"https:\/\/www.theserverside.com\/feature\/Five-RESTful-web-service-client-examples-for-developers\">are invoked<\/a>&nbsp;through an HTTP&nbsp;GET&nbsp;invocation and return the current win, loss or tie count as plain text. As such, these methods each have a JAX-RS&nbsp;@GET&nbsp;annotation, a&nbsp;@Produces&nbsp;annotation indicating they return a text string and a&nbsp;@Path&nbsp;annotation indicating the URL clients need to use in order to invoke the method:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">@GET @Path(\"\/score\/wins\")@Produces(\"text\/plain\")<br>public int getWins() {return Score.<em>WINS<\/em>;}<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>@GET @Path(\"\/score\/losses\")@Produces(\"text\/plain\")<br>public int getLosses() {return Score.<em>LOSSES<\/em>;}<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>@GET @Path(\"\/score\/ties\")@Produces(\"text\/plain\")<br>public int getTies() {return Score.<em>TIES<\/em>;}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;increase&nbsp;methods of this JAX-RS tutorial&#8217;s&nbsp;ScoreService&nbsp;follow a similar pattern, with the exception of the fact that each method is triggered through an HTTP&nbsp;POST&nbsp;invocation:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">@POST @Path(\"\/score\/wins\")@Produces(\"text\/plain\")<br>public int increaseWins() { return Score.<em>WINS<\/em>++; }<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>@POST @Path(\"\/score\/ties\")@Produces(\"text\/plain\")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>public int increaseTies() { return Score.<em>WINS<\/em>++;}<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>@POST @Path(\"\/score\/losses\")@Produces(\"text\/plain\")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>public int increaseLosses() {return Score.<em>LOSSES<\/em>++;}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The final two methods of the&nbsp;ScoreService&nbsp;class enable users to get the JSON-based representation of the complete score or pass query parameters to the web service to update the static properties of the&nbsp;Score&nbsp;class. Both methods use the&nbsp;\/score&nbsp;path, and both produce JSON. But the&nbsp;getScore&nbsp;method is invoked through an HTTP&nbsp;GET&nbsp;request, while the&nbsp;update&nbsp;method is invoked through a&nbsp;PUT.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Just for the record, there is an easier way to return JSON from a RESTful web service than by using the String.format call. You can use @Producer annotations and simply return JavaBeans, but because we are using static variables in our Score class, doing that gets a bit messy. We will save that for a future RESTful web services tutorial with Eclipse.<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">@GET<br>@Path(\"\/score\")<br>@Produces(\"application\/json\")<br>public String getScore() {<br>&nbsp;&nbsp; String pattern = <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \"{ \\\"wins\\\":\\\"%s\\\", \\\"losses\\\":\\\"%s\\\", \\\"ties\\\": \\\"%s\\\"}\";<br>&nbsp;&nbsp; return String.<em>format<\/em>(pattern,&nbsp; Score.<em>WINS<\/em>, Score.<em>LOSSES<\/em>, Score.<em>TIES<\/em> );&nbsp;&nbsp; <br>}<br>&nbsp;<br>@PUT<br>@Path(\"\/score\")<br>@Produces(\"application\/json\")<br>public String update(@QueryParam(\"wins\") int wins, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @QueryParam(\"losses\") int losses, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @QueryParam(\"ties\")&nbsp;&nbsp; int ties) {<br>&nbsp;&nbsp; Score.<em>WINS<\/em>&nbsp;&nbsp; = wins;<br>&nbsp;&nbsp; Score.<em>TIES<\/em>&nbsp;&nbsp; = ties;<br>&nbsp;&nbsp; Score.<em>LOSSES<\/em> = losses;<br>&nbsp;&nbsp; String pattern = <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \"{ \\\"wins\\\":\\\"%s\\\", \\\"losses\\\":\\\"%s\\\", \\\"ties\\\": \\\"%s\\\"}\";<br>&nbsp;&nbsp; return String.<em>format<\/em>(pattern,&nbsp; Score.<em>WINS<\/em>, Score.<em>LOSSES<\/em>, Score.<em>TIES<\/em> );&nbsp;&nbsp; <br>}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Deploy the JAX-RS web service<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that you&#8217;ve coded the JAX-RS tutorial&#8217;s&nbsp;ScoreService, it&#8217;s time for this RESTful web service example in Java using Eclipse to move into the testing stage. Remember that we are using TomEE Plus as our target server, not Tomcat. Tomcat doesn&#8217;t provide built in JAX-RS support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To test the application, first right-click on the restful Java project, and choose&nbsp;<em>Run As &gt; Run on server<\/em>. This will deploy the web project and start the Apache TomEE Plus server that hosts the application.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.theserverside.com\/rms\/editorial\/082218_Eclipse_JAX-RS_deployment_half_column_mobile.png\" alt=\"Eclipse JAX-RS deployment\"\/><figcaption class=\"wp-element-caption\">Run the RESTful web services example in Java on Tomcat.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Test the JAX-RS web service example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When you deploy the JAX-RS tutorial app, there are a number of different ways to test it. One way is to simply type the URL of the RESTful web service example into a web browser. A call to the following URL will trigger a&nbsp;GET&nbsp;invocation and a JSON string representing the initial score should be displayed:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/localhost:8080\/restful-java\/score<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.theserverside.com\/rms\/editorial\/082218_JSON_string_output_half_column_mobile.png\" alt=\"JSON string output\"\/><figcaption class=\"wp-element-caption\">Test the JAX-RS tutorial app by invoking it into a web browser.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To test the&nbsp;increaseTies&nbsp;method, run the following two&nbsp;curl&nbsp;commands in a Bash shell:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ curl -X POST \"http:\/\/localhost:8080\/restful-java\/score\/ties\"<br>$ curl -X GET \"http:\/\/localhost:8080\/restful-java\/score\/\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The JSON string returned from the second command indicates that the number of ties has indeed been incremented by one:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{ \"wins\":\"0\", \"losses\":\"0\", \"ties\": \"1\"}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, use&nbsp;curl&nbsp;to trigger a&nbsp;PUT&nbsp;invocation with query parameters:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ curl -X PUT \"http:\/\/localhost:8080\/restful-java\/score?wins=1&amp;losses=2&amp;ties=3\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This&nbsp;PUT&nbsp;invocation will return the following JSON string:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{ \"wins\":\"1\", \"losses\":\"2\", \"ties\": \"3\"}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Fixing common JAX-RS problems<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the ScoreService class is annotated with @ApplicationPath. This works fine with TomEE Plus, but on other servers or older implementations, the @ApplicationPath annotation is placed on a separate class that extends the JAX-RS Application class. This often solves the problem of RESTful URLs simply not being recognized and triggering a&nbsp;<em>404: The origin server did not find a current representation for the target resource<\/em>&nbsp;error when an attempt is made to invoke them.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> import javax.ws.rs.core.Application;<br> <br> @ApplicationPath(\"\/\") <br> public class ScoreApplication extends Application {<br>   public Set&lt;Class&lt;?&gt;&gt; getClasses() { return new<br>     HashSet&lt;Class&lt;?&gt;&gt;(Arrays.asList(ScoreService.class)); <br>   } <br> }<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On servers where the implementation is Jersey based, the class can be replaced with one that is a bit easier to understand, although it calls on Jersey APIs explicitly, so it will only work with a Jersey based implementation. You just tell it the names of the various packages where JAX-RS annotated web services reside, and it ensures they are loaded:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import javax.ws.rs.ApplicationPath;<br><br>import org.glassfish.jersey.server.ResourceConfig;<br><br>@ApplicationPath(\"\/\")<br>public class ScoreApplication extends ResourceConfig {<br> <br> public ScoreApplication() {<br>   packages(\"com.mcnz.restful.java.example\");<br> }<br>}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And of course, you must ensure you are using TomEE Plus and not Tomcat. As was mentioned earlier, a&nbsp;<a href=\"https:\/\/www.theserverside.com\/blog\/Coffee-Talk-Java-News-Stories-and-Opinions\/How-to-install-Tomcat-as-your-Java-application-server\">standard Tomcat installation<\/a>&nbsp;will not run RESTful web services without a JAX-RS implementation added to the&nbsp;\\lib&nbsp;directory, Gradle build script or Maven POM.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And that&#8217;s a complete, step-by-step JAX-RS RESTful web service example in Java using Eclipse and TomEE Plus.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The full source code for this example can be downloaded from&nbsp;<a href=\"https:\/\/github.com\/cameronmcnz\/java-jakarta-ee\/tree\/master\/restful-java\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create a JAX-RS web service with Tomcat, Eclipse<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you used TomEE in an attempt to create a JAX-RS web service and ran into issues,&nbsp;<a href=\"https:\/\/www.theserverside.com\/video\/Use-Tomcat-Eclipse-to-create-a-JAX-RS-REST-web-service\">watch this new video<\/a>&nbsp;that instead uses Tomcat and Eclipse to create this RESTful web service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Published:&nbsp;01 Jan 2019 Related Videos https:\/\/www.youtube.com\/embed\/Tpr4UfkX9e4 TheServerSide has published a number of articles on the tenets of&nbsp;effective RESTful web service design, along with examples of how to actually create a&nbsp;cloud-native application using Spring Boot&nbsp;and Spring Data APIs. In this JAX-RS tutorial, we will go back to basics by developing the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":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":""},"categories":[5,16,4,9],"tags":[],"class_list":["post-410","post","type-post","status-publish","format-standard","hentry","category-debian","category-informatica","category-programari-lliure","category-tomcat"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=\/wp\/v2\/posts\/410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=410"}],"version-history":[{"count":3,"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=\/wp\/v2\/posts\/410\/revisions"}],"predecessor-version":[{"id":415,"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=\/wp\/v2\/posts\/410\/revisions\/415"}],"wp:attachment":[{"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aran.cat\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}