<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>JakartaEE – Elder Moraes</title>
	<atom:link href="https://eldermoraes.com/category/jakartaee/feed/" rel="self" type="application/rss+xml" />
	<link>https://eldermoraes.com</link>
	<description>Backend | Java | Quarkus | AI | Career</description>
	<language>en-US</language>
	<item>
		<title>Jakarta EE Cookbook</title>
		<link>https://eldermoraes.com/jakarta-ee-cookbook/</link>
		<pubDate>Mon, 06 Jul 2020 00:00:00 +0000</pubDate>
		<category><![CDATA[Book]]></category>
		<category><![CDATA[Career]]></category>
		<category><![CDATA[CDI]]></category>
		<category><![CDATA[Containers]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[EJB]]></category>
		<category><![CDATA[JakartaEE]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Microprofile]]></category>
		<category><![CDATA[Microservices]]></category>
		<guid isPermaLink="false">https://eldermoraes.com/?p=2606</guid>
		<description><![CDATA[About one month ago I had the pleasure to announce the release of the second edition of my book, now called "Jakarta EE Cookbook". By that time I had recorded a video about and you can watch it here: And then came a crazy month and just now I had the opportunity to write a…]]></description>
		<content:encoded><![CDATA[<p>About one month ago I had the pleasure to announce the release of the second edition of my book, now called "Jakarta EE Cookbook". By that time I had recorded a video about and you can watch it here:</p>
<div class="yt-embed"><iframe src="https://www.youtube-nocookie.com/embed/SFbDs1HKEyA" title="YouTube" loading="lazy" allowfullscreen></iframe></div>
<p>And then came a crazy month and just now I had the opportunity to write a few lines about it! :-)</p>
<p>So, straight to the point, what you should know about the book (in case you have any interest in it).</p>
<h4>Target audience</h4>
<p>Java developers working on enterprise applications and that would like to get the best from the Jakarta EE platform.</p>
<h4>Topics covered</h4>
<p>I'm sure this is one of the most complete books of this field, and I'm saying it based on the covered topics:</p>
<ul>
<li>Server-side development</li>
<li>Building services with RESTful features</li>
<li>Web and client-server communication</li>
<li>Security in the enterprise architecture</li>
<li>Jakarta EE standards (and how does it save you time on a daily basis)</li>
<li>Deployment and management using some of the best Jakarta EE application servers</li>
<li>Microservices with Jakarta EE and Eclipse MicroProfile</li>
<li>CI/CD</li>
<li>Multithreading</li>
<li>Event-driven for reactive applications</li>
<li>Jakarta EE, containers &#x26; cloud computing</li>
</ul>
<h4>Style and approach</h4>
<p>The book has the word "cookbook" on its name for a reason: it follows a 100% practical approach, with almost all working code available in the book (we only omitted the imports for the sake of the space).</p>
<p>And talking about the source code being available, it is really available on my Github: <a href="https://github.com/eldermoraes/javaee8-cookbook">https://github.com/eldermoraes/javaee8-cookbook</a></p>
<p>PRs and Stars are welcomed! :-)</p>
<h4>Bonus content</h4>
<p>The book has an appendix that would be worthy of another book! I tell the readers how sharing knowledge has changed my career for good and how you can apply what I've learned in your own career.</p>
<h4>Surprise, surprise</h4>
<p>In the first 24 hours of its release, this book simply reached the 1st place at Amazon among other Java releases! Wow!</p>
<p><img src="https://eldermoraes.com/wp-content/uploads/2020/07/1st-place-241x300.png" alt=""></p>
<p>Of course, I'm more than happy and honored for such a warm welcome given to my baby... :-)</p>
<p>If you are interested in it, we are in the very last days of the special price in celebration of its release. You can take a look here <a href="http://book.eldermoraes.com">http://book.eldermoraes.com</a></p>
<p>Leave your comments if you need any clarification about it. See you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Top 20 Jakarta EE Experts to Follow on Twitter</title>
		<link>https://eldermoraes.com/top-20-java-ee-experts-to-follow-on-twitter/</link>
		<pubDate>Tue, 08 Jan 2019 00:00:00 +0000</pubDate>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[JakartaEE]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Microprofile]]></category>
		<category><![CDATA[Social]]></category>
		<guid isPermaLink="false">https://eldermoraes.com/?p=1356</guid>
		<description><![CDATA[This is the most viewed post of this blog, so I believe it deserves an update now in 2020! Its first version was written back in 2017. There's a lot of different opinions in this kind of lists, and there will be always somebody or something missing... just don't be too passionate or take things…]]></description>
		<content:encoded><![CDATA[<p><img src="https://eldermoraes.com/wp-content/uploads/2017/06/top20-twitter-jakartaee-1-300x150.png" alt=""></p>
<p>This is the most viewed post of this blog, so I believe it deserves an update now in 2020! Its first version was written back in 2017.</p>
<p>There's a lot of different opinions in this kind of lists, and there will be always somebody or something missing... just don't be too passionate or take things personally, ok?! ;-)</p>
<p>******************************************************</p>
<p>We all have to agree: there are tons of tons of information shared through social media. It's no different on Twitter.</p>
<p>When we talk about staying tuned with some technology, it's important to have some kind of focus. Otherwise, you could end up confused or, worst, getting bad and/or wrong information.</p>
<p>For these reasons I have a small but incredible list of people/accounts that I use to follow on Twitter to get really good information about Jakarta EE.</p>
<p>If you are passionate about Jakarta EE like me, I truly hope this list may be helpful to you. If you are not, I hope you enjoy as well! ;-)</p>
<p>Important: the list isn't a ranking, so don't judge the account by the position at the list. In fact, don't judge anyone by anything...</p>
<h3>Jakarta EE - <a href="https://twitter.com/JakartaEE">@JakartaEE</a></h3>
<p>The official Jakarta EE handle.</p>
<h3>Wayne Beaton - <a href="https://twitter.com/waynebeaton">@waynebeaton</a></h3>
<p>Wayne is a Director of Open Source Projects at the Eclipse Foundation. Undoubtedly, Jakarta EE is one of the biggest projects at Eclipse today (if not the biggest one), so it's important to stay tunned with Wayne has to say.</p>
<h3>Adam Bien - <a href="http://twitter.com/AdamBien">@AdamBien</a></h3>
<p>Adam works as a freelancer with Java since JDK 1.0, with Servlets/EJB since 1.0 and before the advent of J2EE in several large-scale applications. He is an architect and developer (with usually 20/80 distribution) in Java (SE / EE / FX) projects. He has written several books about JavaFX, J2EE, and Java EE, and he is the author of <a href="http://realworldpatterns.com">Real World Java EE Patterns—Rethinking Best Practices</a> and <a href="http://press.adam-bien.com/real-world-java-ee-night-hacks-dissecting-the-business-tier.htm">Real World Java EE Night Hacks—Dissecting The Business Tier</a>.</p>
<p>He is also a <a href="http://java.net/website/java-champions/bios.html#Bien">Java Champion</a>, <a href="http://netbeans.org/community/contribute/dreamteam.html">NetBeans Dream Team Founding Member</a>, <a href="http://apex.oracle.com/pls/otn/f?p=19297:4:409221233034912::NO:4:P4_ID:3120">Oracle ACE Director</a>, <a href="http://www.oracle.com/technetwork/issue-archive/2010/10-nov/o60eca-176293.html#bien">Java Developer of the Year 2010</a> and has a huge amount of nominations as JavaOne Rockstar.</p>
<h3>Kevin Sutter - <a href="http://twitter.com/kwsutter">@kwsutter</a></h3>
<p>Kevin Sutter is the lead architect for the Jakarta EE and JPA solutions for WebSphere Application Server and the WebSphere Liberty Profile. He is also very active with Java and open-source strategies as they relate to IBM’s application middleware.</p>
<h3>Ivar Grimstad - <a href="http://twitter.com/ivar_grimstad">@ivar_grimstad</a></h3>
<p>Ivar Grimstad is Java Champion, JUG Leader, JCP Spec Lead, EC and EG Member, NetBeans Dream Team and International Speaker.</p>
<p>He is the PMC (Project Management Committee) Lead of EE4J and Jakarta EE Developer Advocate at Eclipse Foundation.</p>
<h3>David Blevins - <a href="http://twitter.com/ivar_grimstad">@dblevins</a></h3>
<p>David Blevins is the founder of Tomitribe and a veteran of open source Jakarta EE. He has been both implementing and defining Enterprise Java specifications for more than 10 years and has a strong drive to see it simple, testable, and as light as Java SE. Blevins is cofounder of OpenEJB (1999), Geronimo (2003), and TomEE (2011). He is a member of the EJB 3.0, EJB 3.1, EJB 3.2, Java EE 6, Java EE 7, and Java EE 8 Security Expert Groups, and a member of the Apache Software Foundation. Blevins is a contributing author to Component-Based Software Engineering: Putting the Pieces Together (Addison Wesley). Blevins is also a regular speaker at JavaOne, Devoxx, ApacheCon, OSCon, JAX, and other Java-focused conferences.</p>
<h3>Otavio Santana - <a href="http://twitter.com/otaviojava">@otaviojava</a></h3>
<p>Otávio Santana is a developer and enthusiast of open source. He is an evangelist and practitioner of agile philosophy and polyglot development in Brazil. Santana is a JUG leader of JavaBahia and SouJava, and a strong supporter of Java communities in Brazil, where he also leads the BrasilJUGs initiative to incorporate Brazilian JUGs into joint activities.</p>
<p>He is also the co-creator of <a href="http://www.jnosql.org/">Jakarta NoSQL</a>, a Java framework that streamlines the integration of Java applications with NoSQL databases. It defines a set of APIs to interact with NoSQL databases and provides a standard implementation for most NoSQL databases. This helps to achieve very <em>low coupling</em> with the underlying NoSQL technologies used.</p>
<h3>Java Champions - <a href="http://twitter.com/Java_Champions">@Java_Champions</a></h3>
<p>Well, why the Java Champions handle is here? Because many Java Champions are Jakarta EE experts, so following the official Twitter is nice to be in touch with what they are saying about it.</p>
<h3>Alex Theedom - <a href="https://twitter.com/alextheedom">@alextheedom</a></h3>
<p>Trainer, Java Champion, Jakarta EE spec committee, author of Jakarta EE books and courses. Conference speaker and blogger.</p>
<h3>OmniFaces - <a href="http://twitter.com/OmniFaces">@OmniFaces</a></h3>
<p>OmniFaces is a utility library for JSF 2 that focusses on utilities that ease everyday tasks with the standard JSF API. OmniFaces is a response to frequently recurring problems encountered during ages of professional JSF development and from questions being asked on <a href="http://stackoverflow.com">Stack Overflow</a>.</p>
<h3>Dmitry Kornilov - <a href="https://twitter.com/m0mus">@m0mus</a></h3>
<p>Dmitry has over 20 years of experience in design and implementation of complex software systems, defining systems architecture, team leading and project management. He has worked as project leader of EclipseLink and Yasson and as spec lead of JSON-P and JSON-B specifications.</p>
<h3>Steve Millidge - <a href="https://twitter.com/l33tj4v4">@l33tj4v4</a></h3>
<p>Steve is the Founder and Director of Payara and C2B2 Consulting. Having used Java extensively since pre1.0, Steve has over 15 years’ experience as a field-based Professional Service Consultant along with extensive knowledge of Java middleware.</p>
<p>Before running his own business, Steve worked for Oracle as a Principal Consultant in Oracle’s Technology Architecture Practice, specializing in Business Process Integration and scalable n-tier component architectures.</p>
<h3>Emily Jiang - <a href="https://twitter.com/emilyfhjiang">@emilyfhjiang</a></h3>
<p>Emily is a Java Champion and has been working on MicroProfile since 2016. She also leads the specifications of MicroProfile Config, Fault Tolerance and Service Mesh. She works for IBM as Liberty Architect for MicroProfile and CDI and is heavily involved in Java EE implementation in Liberty releases.</p>
<h3>Arjan Tijms - <a href="https://twitter.com/arjan_tijms">@arjan_tijms</a></h3>
<p>Arjan is a Jakarta EE committer and member of the Jakarta EE Steering Committee.</p>
<h3>MicroProfile - <a href="https://twitter.com/MicroProfileIO">@MicroProfileIO</a></h3>
<p>MicroProfile is a baseline platform definition that optimizes Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes. The initially planned baseline is JAX-RS + CDI + JSON-P, with the intent of the community having an active role in the MicroProfile definition and roadmap.</p>
<h3>Sebastian Daschner - <a href="https://twitter.com/DaschnerS">@DaschnerS</a></h3>
<p>Sebastian has been working with Java enterprise software development for many years. Besides his work for clients, he set a high priority in educating developers in conference presentations, video courses, and training. He believes that teaching others not only greatly improves their situation but also educates yourself.</p>
<h3>David Heffelfinger - <a href="http://twitter.com/ensode">@ensode</a></h3>
<p>David R. Heffelfinger is an independent consultant based in the greater Washington DC area. He has authored several books on Java EE and related technologies. Heffelfinger has been architecting, designing, and developing software professionally since 1995. He has been using Java as his primary programming language since 1996. He has worked on many large-scale projects for several clients, including the US Department of Homeland Security, Freddie Mac, Fannie Mae, and the US Department of Defense. He has a master's degree in software engineering from Southern Methodist University, Dallas, Texas. Heffelfinger is a frequent speaker at Java conferences such as Oracle Code One (forme JavaOne).</p>
<h3>John Clingan - <a href="https://twitter.com/jclingan">@jclingan</a></h3>
<p>John is Product Manager at Red Hat and an ex Java EE PM. He is also a MicroProfile co-founder.</p>
<h3>Josh Juneau - <a href="http://twitter.com/javajuneau">@javajuneau</a></h3>
<p>Josh Juneau works as an application developer, system analyst, and database administrator. He is active in many fields of application development but primarily focuses on Jakarta EE. Juneau is a technical writer for Oracle Technology Network, <em>Java Magazine</em>, and Apress. He is a member of the NetBeans Dream Team, the JCP, and a part of the JSR 372 Expert Group. He enjoys working with the Java community—he is the director of meetings for the Chicago Java User Group.</p>
<h3><strong>Tanja Obradovic</strong> - <a href="https://twitter.com/TanjaEclipse">@TanjaEclipse</a></h3>
<p>Tanja is the Jakarta EE Program Manager at Eclipse Foundation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Boring Enterprise Java - AIRHACKS.FM Podcast</title>
		<link>https://eldermoraes.com/boring-enterprise-java-airhacks-fm-podcast/</link>
		<pubDate>Fri, 31 Aug 2018 00:00:00 +0000</pubDate>
		<category><![CDATA[Book]]></category>
		<category><![CDATA[Career]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[JakartaEE]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Microprofile]]></category>
		<category><![CDATA[Social]]></category>
		<guid isPermaLink="false">https://eldermoraes.com/?p=1889</guid>
		<description><![CDATA[Originally posted at Adam Bien's blog: http://adambien.blog/roller/abien/entry/boringenterprisejavaairhacksfm An airhacks.fm podcast conversation with Elder Moraes (@elderjava) about Java EE at JavaONE, why Java EE at all, enjoying boring stuff, Java EE for pet projects, thinking freely about business problems, no distractions, servlets and JSPs, Java as career choice, Jakarta EE opinions, Oracle's Java EE stewardship, Java…]]></description>
		<content:encoded><![CDATA[<p>Originally posted at Adam Bien's blog: <a href="http://adambien.blog/roller/abien/entry/boring_enterprise_java_airhacks_fm">http://adambien.blog/roller/abien/entry/boring_enterprise_java_airhacks_fm</a></p>
<p>An <a href="http://airhacks.fm/">airhacks.fm</a> podcast conversation with Elder Moraes (<a href="https://twitter.com/elderjava">@elderjava</a>) about Java EE at JavaONE, why Java EE at all, enjoying boring stuff, Java EE for pet projects, thinking freely about business problems, no distractions, servlets and JSPs, Java as career choice, Jakarta EE opinions, Oracle's Java EE stewardship, Java EE 8 being late, Jakarta EE should remain boring, Jakarta EE and profiles, an idea for a Jakarta EE profile creation process, Eclipse Foundation and agility, the pace of MicroProfile, thoughts on Cloud Native, Java EE in Cloud Native environments, Sebastian Daschner and successful Java EE careers, Java EE impact on startups, ES 6, TypeScript, thoughts on serverless, future of Jakarta EE, JVM overhead and microservices, GraalVM and Nashorn, JavaONE vs Oracle Code, Java EE 8 recipes in the <a href="https://www.amazon.com/dp/1788293037/ref=cm_sw_r_tw_dp_U_x_F9KZAbRPQA7EK">Java EE 8 Cookbook</a>.</p>
<p>Checkout: <a href="https://eldermoraes.com/">eldermoraes.com</a>, <a href="https://github.com/eldermoraes">GitHub</a> and <a href="https://twitter.com/elderjava">@elderjava</a>.</p>
<p>Subscribe to <a href="http://airhacks.fm/">airhacks.fm podcast</a> via: <a href="https://pcr.apple.com/id1296655154">RSS</a> <a href="https://itunes.apple.com/de/podcast/airhacks-fm/id1296655154?l=en">iTunes</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Develop, build e and run Java-EE-8-powered microservices</title>
		<link>https://eldermoraes.com/develop-build-e-and-run-java-ee-8-powered-microservices/</link>
		<pubDate>Mon, 13 Aug 2018 00:00:00 +0000</pubDate>
		<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[JakartaEE]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[Microservices]]></category>
		<guid isPermaLink="false">https://eldermoraes.com/?p=1838</guid>
		<description><![CDATA[Learn how to work with Java EE 8 microservices in this guest post by Mario-Leander Reamer, a senior Java developer and the author of Building RESTful Microservices with Java EE 8. In this section, you're going to take a look at the following things: How to develop, build, and run your first Java-EE-8-powered microservices Required…]]></description>
		<content:encoded><![CDATA[<p><em>Learn how to work with Java EE 8 microservices in this guest post by Mario-Leander Reamer, a senior Java developer and the author of</em> <a href="https://www.packtpub.com/application-development/building-restful-web-services-java-ee-8"><em>Building RESTful Microservices with Java EE 8</em></a><em>.</em></p>
<p>In this section, you're going to take a look at the following things:</p>
<ul>
<li>How to develop, build, and run your first Java-EE-8-powered microservices</li>
<li>Required Java EE 8 dependencies for basic web-service development</li>
<li>Basic components of any JAX-RS-based web service</li>
<li>Deployment of a thin WAR artifact using Payara Server 5</li>
</ul>
<p>Time to get started and dive into the code. The following is a prepared IDE and a raw skeleton Maven project. What you see here is a very basic POM file:</p>
<p><img src="https://eldermoraes.com/wp-content/uploads/2018/08/je8m01.png" alt=""></p>
<p>There's one thing missing though; first, you need to define the required dependency for the Java EE 8 API:</p>
<pre><code>&#x3C;dependency>
  &#x3C;groupId>javax&#x3C;/groupId>
  &#x3C;artifactId>javaee-api&#x3C;/artifactId>
  &#x3C;version>8.0&#x3C;/version>
  &#x3C;scope>provided&#x3C;/scope>
&#x3C;/dependency>
</code></pre>
<p>Specify version as 8.0. You must also define the proper scope for this, which, in this case, is provided, because the Java EE 8 API will later be provided by the application server. Next, add a beans.xml descriptor to the WEB-INF directory of the web application:</p>
<pre><code>&#x3C;?xml version="1.0" encoding="UTF-8"?>
&#x3C;beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
       bean-discovery-mode="all">
&#x3C;/beans>
</code></pre>
<p>Next, you need to bootstrap your JAX-RS application. Create a class called JAXRSConfiguration. The name really doesn't matter. What's important is that this class extends from the Application base class. Bear in mind the javax.ws.rs.core package while selecting Application. It's also important that you specify the @ApplicationPath annotation. This will be the base path to access the REST API:</p>
<pre><code>package com.packtpub.javaee8;

//skipping imports to save space

/**
 * Configures a JAX-RS endpoint.
 */
@ApplicationPath("api")
public class JAXRSConfiguration extends Application {
}
</code></pre>
<p>Once you've bootstrapped JAX-RS, what's missing is a proper REST resource. Create a class called HelloWorldResouce. You’ve used the @Path annotation, which will be the path this resource will be accessible under. Call that "hello". Next up, create a method that will produce the proper response once called: helloWorld. Use the proper Response here; annotate this using the @GET annotation, as you’ll need to issue GET requests later on, and say that it produces MediaType.APPLICATION_JSON. Then return Response.ok, where ok is HTTP status 200 of a response when you call the build. So, what should be used as the response? Use Map&#x3C;String, String> as the response and return singletonMap with the message key and the Hello World value:</p>
<pre><code>package com.packtpub.javaee8;

//skipping imports to save space
/**
* The REST resource implementation class.
*/
@Path("hello")
public class HelloWorldResource {
   @GET
   @Produces(MediaType.APPLICATION_JSON)
   public Response helloWorld() {
      Map&#x3C;String, String> response = singletonMap("message", 
                     "Building Web Services with Java EE 8.");
      return Response.ok(response).build();
   }
}
</code></pre>
<p>You should already have a basic working microservice. Now deploy this onto our Payara Server 5 and run it. You’re going to deploy the WAR file that’s been built; you can see that it's already been deployed and the deployment took 5.1 milliseconds.</p>
<p>Check your browser. You should see the <strong>"Hello World."</strong> message, as shown in the following screenshot:</p>
<p><img src="https://eldermoraes.com/wp-content/uploads/2018/08/je8m02.png" alt=""></p>
<p>Now modify the value here to "Building Web Services with Java EE 8". Deploy this once more and update your artifact. The new version has been deployed. Go back to your browser to check whether you have the proper response message:</p>
<p><img src="https://eldermoraes.com/wp-content/uploads/2018/08/je8m03.png" alt=""></p>
<p>That's all for this section; in the next section, you’ll see how to containerize a Java EE 8 microservice.</p>
<h3>Containerizing Java EE 8 microservices</h3>
<p>In this section, you're going to take a look at how to containerize and run Java EE 8 microservices using Docker. You'll learn how to write a basic Dockerfile and see how to build and run the Docker image using Payara Server full and Payara Server micro edition. Open the IDE to the microservice project from the previous section. All that's missing here is Dockerfile, so create one.</p>
<p>You must be wondering about which base image you should use. You have two basic options when using Payara—you can either use the server-full image or the Payara micro edition. For the purposes of this tutorial, use the full version of Payara first. Dockerfile will be as follows:</p>
<pre><code>FROM payara/server-full:5-SNAPSHOT
COPY target/hello-javaee8.war $DEPLOY_DIR
</code></pre>
<p>In the preceding Dockerfile, you’ve mentioned that you're using payara/server-full. You need to use its correct version, which, in this case, is version 5-SNAPSHOT. Then, you can copy the hello-javaee8.war file of your microservice into the correct location of the produced image. You need to issue a COPY command from target/hello-javaee8.war and then copy this into the deployment directory. To check whether it works, open a console, keeping in mind that you're in the right directory. Check whether everything is packaged nicely by calling mvn package, just to make sure the WAR file is in the correct state. If it is, you'll see things running while compiling, an absence of tests, and an updated WAR file:</p>
<p><img src="https://eldermoraes.com/wp-content/uploads/2018/08/je8m04.png" alt=""></p>
<p>Build Docker using -t, which specifies the tag you want to use, by calling hello-javaee8 and giving it version number 1.0:</p>
<pre><code>>docker build -t hello-javaee8:1.0 .
</code></pre>
<p>Use the following command to see whether your server starts up:</p>
<pre><code>>docker run -it -p 8080:8080 hello-javaee8:1.0
</code></pre>
<p>You’ve mapped port 8080 from the container onto your Docker host. You'll see that the Payara Server is starting up in the console (which would take only a couple of seconds), after which the application will be deployed. To check whether you can reach the web service, hit the IP address as shown in the following screenshot:</p>
<p><img src="https://eldermoraes.com/wp-content/uploads/2018/08/je8m05.png" alt=""></p>
<p>Now it’s time to see how to use the Payara micro edition. Stop the service you just created and delete the contents of Dockerfile. First, you need to change FROM by use a different base tag for this image (payara/micro:5-SNAPSHOT). Then, copy the hello-javaee8.war file into the proper location for this base image. Next, copy the WAR file in the target directory and call it to /opt/payara/deployments. This is the default deployments directory for the micro edition base container. The Dockerfile should look as follows:</p>
<pre><code>FROM payara/micro:5-SNAPSHOT
COPY target/hello-javaee8.war /opt/payara/deployments
</code></pre>
<p>Switch back to the console and issue the Docker build command again:</p>
<pre><code>>docker build -t hello-javaee8:1.0 .
</code></pre>
<p>Fire up the container again:</p>
<pre><code>>docker run -it -p 8080:8080 hello-javaee8:1.0
</code></pre>
<p>You can see that the output in the console changes, as you're using the Payara micro runtime this time. This takes a couple of seconds to spin up the web service. You can see that the REST Endpoints are available. To check again, go to the management console; you can see that you have a running container. Try calling the web service from the browser, as shown in the following screenshot:</p>
<p><img src="https://eldermoraes.com/wp-content/uploads/2018/08/je8m06.png" alt=""></p>
<p>As you can see, everything's working just fine and you have a running dockerized version of the service.</p>
<p><em>You’ve learned the basics of working with Java EE 8 microservices. To learn more about RESTful web services and Java EE 8, you can explore</em> <a href="https://www.amazon.com/Building-RESTful-Web-Services-Java/dp/1789532884"><em>Building RESTful Microservices with Java EE 8</em></a><em>. It’s a comprehensive guide that shows you how to use the APIs provided by Java EE to create RESTful web services. The book goes in depth to explain the usage of different JAX-RS APIs, while also delving into the structure of web services and data sharing between applications. The book is a must-read for Java developers keen on learning how to implement web services using the latest Java EE 8 APIs.</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>How to connect external services and configure orchestrated applications</title>
		<link>https://eldermoraes.com/how-to-use-jakarta-ee-with-orchestrated-containers/</link>
		<pubDate>Fri, 03 Aug 2018 00:00:00 +0000</pubDate>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[JakartaEE]]></category>
		<guid isPermaLink="false">https://eldermoraes.com/?p=1811</guid>
		<description><![CDATA[Learn how to connect external services and configure orchestrated applications in this tutorial by Sebastian Daschner, the author of Architecting Modern Java EE Applications. The orchestration framework orchestrates and integrates enterprise applications in clustered environments. It takes a lot of work off the used application technology. Container orchestration also greatly simplifies the configuration of orchestrated…]]></description>
		<content:encoded><![CDATA[<p><img src="https://eldermoraes.com/wp-content/uploads/2017/07/connections-300x188.jpg" alt=""></p>
<p><em>Learn how to connect external services and configure orchestrated applications in this tutorial by Sebastian Daschner, the author of</em> <a href="https://www.packtpub.com/application-development/architecting-modern-java-ee-applications"><em>Architecting Modern Java EE Applications</em></a><em>.</em></p>
<p>The orchestration framework orchestrates and integrates enterprise applications in clustered environments. It takes a lot of work off the used application technology. Container orchestration also greatly simplifies the configuration of orchestrated applications and connection to external services.</p>
<h2>Connecting external services</h2>
<p>Client controls require URLs to connect against in order to integrate external services. The URLs traditionally have been configured in files, which potentially differed in various environments. In an orchestrated environment, the application can resolve external services using a logical name via DNS. The following code snippet shows how to connect against the <strong>cloud processor</strong> application:</p>
<pre><code>@ApplicationScoped
public class HelloCloudProcessor {

   private Client client;
   private WebTarget target;

   @PostConstruct
   private void initClient() {
       client = ClientBuilder...
       target = client.target("http://cloud-processor:8080/processor/resources/hello");
   }

   public String processGreeting() {
       ...
   }
}
</code></pre>
<p>The same holds true for other URLs (for example datasource definitions). The application server configuration can simply point to the name of the database service and use it to resolve the corresponding instance at runtime.</p>
<h2>Configuring orchestrated applications</h2>
<p>Resolving services by logical names already eliminates a lot of configuration in the application. Since the same container image is being used in all environments, a potentially different configuration needs to be inserted from the orchestration environment. As shown in the previous example, Kubernetes config maps tackle this situation. The <strong>hello-cloud</strong> application expects that at runtime a properties file will reside under <strong>/opt/config/application.properties</strong>. The project code will hence access this location. The following demonstrates the integration of the properties file using a CDI producer:</p>
<pre><code>public class HelloGreeter {

   @Inject
   @Config("hello.greeting")
   String greeting;

   @Inject
   @Config("hello.name")
   String greetingName;

   public String processGreeting() {
       return greeting + ", " + greetingName;
   }
}
</code></pre>
<p>The CDI producer is defined similarly to the configuration example shown previously:</p>
<pre><code>@ApplicationScoped
public class ConfigurationExposer {

   private final Properties properties = new Properties();

   @PostConstruct
   private void initProperties() {
       try (InputStream inputStream =
               new FileInputStream("/opt/config/application.properties")) {
           properties.load(inputStream);
       } catch (IOException e) {
           throw new IllegalStateException("Could not init configuration", e);
       }
   }

   @Produces
   @Config("")
   public String exposeConfig(InjectionPoint injectionPoint) {
       Config config = injectionPoint.getAnnotated().getAnnotation(Config.class);
       if (config != null)
           return properties.getProperty(config.value());
       return null;
   }
}
</code></pre>
<p>The application loads the contents of the properties file into the properties map and produces the configured values using CDI. All managed beans can inject these values, which emerge from the Kubernetes config map.</p>
<p>In order to realize secret configuration values, Kubernetes includes the concept of secrets. A common practice is to make the contents of the secrets accessible in containers using environment variables.</p>
<p>Java applications use the <strong>System.getenv()</strong> method to access environment variables. This functionality is used for both secrets and config map values, respectively.</p>
<p>The demonstrated approaches and examples enable an enterprise application to be deployed, managed, and configured in a container orchestration cluster. They are sufficient for a majority of use cases.</p>
<p><em>You can now connect external services and configure orchestrated applications in Jakarta EE. If you found this tutorial helpful, you can explore</em> <a href="https://www.amazon.com/Architecting-Modern-Java-Applications-business-oriented/dp/1788393856"><em>Architecting Modern Java EE Applications</em></a><em>, an end-to-end guide to designing and developing modern, business-oriented applications using Java EE 8. So if you’re a Java EE developer keen on architecting enterprise-grade applications, this book is a must-read!</em></p>
]]></content:encoded>
	</item>
</channel>
</rss>
