Adam Bien's Weblog

Java EE -- The Competitive Advantage For Startups

At the infoshare.pl 2017 conference in Gdansk I got 30 minutes time to explain why Java EE is happily used by startups with live hacking. Deployment to Amazon Cloud (AWS) included:

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Building and Running a Fullstack Java EE ThinWAR in Oracle Container Cloud Service ...in 7 Minutes

7 minutes are sufficient to:

  1. Create Java EE 7 application (single JAX-RS endpoint) from scratch with Maven 3
  2. Build an executable Docker image based on CentOS 7, openJDK 8, GlassFishv5 and a ThinWAR (the app from above). The glassfishv5 file was used from: https://github.com/AdamBien/docklands
  3. Push the executable image to public docker registry: http://hub.docker.com/u/airhacks/
  4. Create a service in Oracle Container Cloud Service: https://cloud.oracle.com/container

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Beautiful Java EE, JWT, EAR cases, Dynamic Serialization, @Asynchronous Testing or 39th airhacks.tv is online

39th airhacks.tv is available:

Any questions left? File the your questions now https://gist.github.com/AdamBien/37e7dde8f2ef447edfa04354b9819b7d or see you in MUC at: http://workshops.adam-bien.com.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Java EE Application Servers Are Not Suitable To Host Microservices

Due to low footprint, fast startup and low runtime overhead ("The Overhead Of Java EE Application Servers"), deploying multiple WARs into one application server instance running on a single JVM does not save a considerable amount of resources unless you have to deal with Netflix-like scale (ten thousands of dynamic VMs).

You could manage multiple WAR-microservices on a shared application server, but this approach would come with serious disadvantages:

  1. Less Isolation: A misbehaving WAR can influence other microservices
  2. Complicated Monitoring: it is harder to monitor the activity of a single WAR
  3. Less Stability: a redeployment of a WAR could influence others (memory leaks, classloader leaks)
  4. Less scalability: it is harder to scale a single process, than multiple processes
  5. More complex CI / CD: an executable image will contain multiple microservices and requires coordination between teams

Java EE Application Servers are not suitable to host multiple microservices. The way to go is to ship exactly one Thin WAR ("Thin WARs, Java EE 7, Docker and Productivity") with one application server instance and consider the OS, JVM, applicaton server and the Thin WAR as the executable unit.

A Java EE microservice architecture is about multiple application servers hosting exactly one WAR ("Why Not One Application Per Server?) communicating with each other. Using a single application server instance as a microservice runtime is too brittle, too complicated and hard to justify with numbers.

See you at Java EE Microservices where we build Java EE Thin WARs, and Java EE CI/CD, Testing and Quality workshop where the Thin WARs get automatically deployed.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

2017 Free Summer Java Events, Workshops and Sessions

  1. Free: Oracle Code Brussels, 6th June, 9 AM, Enterprise java.net: A Slideless Keynote
  2. Devoxx Krakow, 21th June, Session: "Build To Last: From Frontend To Backend #slideless #talk"
  3. 27th-29th June, airhacks.com: Java EE 7 (and a bit 8) Bootstrap (very few seats available), Effective (very few seats available) and Java EE CI, CD (Jenkins 2 Pipelines), Testing and Quality Workshops at Munich's Airport, Terminal 2. workshops.adam-bien.com
  4. Free: July 18th, Munich (location TBD), evening event: "Pragmatic Architectures With Microservices" follow up meeting in Munich. This time #slideless (one slide recap).

...or see you at airhacks.io or airhacks.tv.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

EAR Use Cases, JSF Modularization Again, JWT, CRUD Generators, Subset Entity Serialization, @Asynchronous Testing, Fat WARs, or 39th airhacks.tv

Topics (gist) for the 39th airhacks.tv, June 5th, 5 pm CET (one hour earlier):

  1. News
  2. Follow up JSF modularization
  3. Beautiful Java EE frontends
  4. JWT Authentication With Java EE
  5. Java EE CRUD Code Generators / bootstrap Frameworks
  6. Are there still use cases for EARs?
  7. Serializing a dynamic subset of fields / properties
  8. JPA with WildFly
  9. Testing @Asynchronous methods
  10. Fat WARs -- if you really need them
  11. Use Cases and experiences with Java EE Batch
  12. Multitenancy with JPA
  13. Opinions about Multiple WARs, one server, one DB

Ask questions during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.tv or http://www.ustream.tv/channel/adambien

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Setting Timeout For JAX-RS / TomEE CXF Client

The name of the "read" and "connection" timeout properties is not standardized in Java EE 7. For TomEE / CXF clients you will have to use the "CXF-proprietary" names:


import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

Client client = ClientBuilder.newClient();
client.property("http.connection.timeout", 500L);
client.property("http.receive.timeout", 500L);

The name differs in Jersey (used in GlassFish / Payara), but the semantics are the same.

See you at Java EE Microservices. Is Munich's airport too far? Learn from home: javaeemicro.services.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Java EE (and Docker) Quickstart

  1. Create a Thin WAR Java EE project. Name it "micro".
  2. Create a Dockerfile in project folder with the following content:
                
                FROM airhacks/wildfly
                COPY ./target/micro.war ${DEPLOYMENT_DIR}                
                
            

    Also airhacks/payara, airhacks/tomee images are available from https://hub.docker.com/u/airhacks/. The docker files are maintained in https://github.com/AdamBien/docklands.

  3. Perform build from project folder: mvn package && docker build -t airhacks/micro .
  4. Run the project: docker run -d -p 8080:8080 --name micro airhacks/micro

See it in action: https://www.youtube.com/watch?v=P6Bk3Eiz3kE.

Behind the scenes:

  1. CentOS 7, JDK 1.8, the chosen application server (WildFly, Payara, TomEE) is going to be downloaded the first time (~560 MB, see https://youtu.be/hoqJdH87e7g) from https://hub.docker.com/u/airhacks/.
  2. All subsequent builds will only rebuild the Thin WAR -- it will take milliseconds. The smaller the WAR, the higher the productivity: https://youtu.be/5N4EUDhrkec
See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Gartner and Java EE, BCE, Modular JSF, Monitoring, JAX-RS Refactoring or 39th airhacks.tv

55 mins, 125 live attendees, ~20 topics ranging from Gartner and Java EE, BCE architecture, modular JSF, monitoring, REST refactoring, how to learn Java EE (see all topics), or the 38th airhacks.tv episode is available:

Any questions left? A fresh question queue is setup. Ask now: https://gist.github.com/AdamBien/b1a66dafdae21c0c40d647f05f44e57c and see you at June, 5th, 2017, 6 pm CET.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Java EE (and Microservice) Quickstart

  1. Create Thin WAR project with: mvn archetype:generate -Dfilter=com.airhacks:javaee7-essentials-archetype. (see: Setting Up Java EE 7 Projects With Maven 3)

    Result: 24 lines of pom.xml. The pom.xml only conatins a single dependency to Java EE 7 API. In real world projects you will only need to add test dependencies like JUnit or Mockito. The file beans.xml (one tag), was created to enable Depenency Injection (DI) everywhere and the annotated class JAXRSConfiguration activates JAX-RS under the resources uri. The generated Thin WAR project is a production ready template for Java EE / Microservices / Thin WARs.
  2. Create a JAX-RS resource, like .e.g.
            
        import javax.ws.rs.GET;
        import javax.ws.rs.Path;
        
        @Path("message")
        public class HelloResource {
    
            @GET
            public String message() {
                return "works!";
            }       
        }
    
    
  3. Perform mvn package and copy the Thin WAR ./target/[NAME].war (~4 kB) into the autodeploy / deploy folder of Java EE 6 / 7 / 8 application server of your choice.
  4. ...or download NetBeans "Java EE Edition", open the project, and click "run".
  5. Open the browser with: http://localhost:8080/[NAME]/resources/message

Use a full profile Java EE application servers (Payara, WildFly, TomEE, WebLogic, Websphere Liberty Profile). The download size varies between 55 MB and 200 MB. The runtime overhead is around 50 MB RAM (see live memory profiling: "The (RAM) Overhead Of Java EE Application Servers").

For mainstream (microservices) projects there is no further tuning, configuration or optimization required.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License