Adam Bien's Weblog

Pushing Full Profile Java EE Applications To Amazon EC2 Container Service

In this screencast I created from scratch with Maven, built (CentOS, JDK, Payara, Thin WAR, taken from docklands) and pushed a Full Profile Java EE 7 (Payara Full) application to Amazon EC2 Container Service cluster.

The ECS cluster is running on the smallest "free tier" available Amazon EC2 machine t2.micro (1 CPU and 1 GB RAM). t2.nano (512 MB max) would also work -- but is not eligible for free tier.

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

20+ Topics in 45 mins -- 35th airhacks.tv Questions and Answers

90 live attendees, 20+ topics in 45 mins ranging from Java EE 8 News over JPA relations in MSAs to cross-field validation. The 35th (2.2017) airhacks.tv is available:

Watch past episodes with: airhacks.tv playlist.

Any questions left? Ask now gist.github.com/AdamBien/4500d4f7e546ea7f242baaec2e2f6616 and see you at March, 6th, 6pm 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

JPA and Microservices, RxJava, CRUD and TX, Gradle, Cross Field Validation, Licensing, MDA or Topics For The 35th airhacks.tv

Questions (gist) for the 35th airhacks.tv, February 8th (exceptionally at Wednesday, not Monday), 6 pm CET:

  1. Java EE 8 News
  2. Java SDK for Oracle Bare Metal Cloud Services github.com/oracle/bmcs-java-sdk
  3. Handling JPA relationships in CRUD microservice scenarios
  4. The role of RxJava in typical enterprise applications
  5. JAX-RS: returning Response vs. objects and JSON vs. XML
  6. Useful Java EE 7 tools
  7. Cross-field entity validation
  8. GPL/LGPL, opensource and commercial projects
  9. What is www.pac4j.org?
  10. Transactions, CRUD-Services (BCE), EntityManager and connection sharing
  11. (SCM) Managing, Structuring and organizing microservices
  12. Gradle adoption, gradle vs. maven
  13. Dealing with (setup) scripts in Java EE environment
  14. Oracle JDK vs. openJDK and licensing
  15. Greatings from Panama: gitbook.com/book/avbravo/jmoordb
  16. The role of Model Driven Architecture in Java EE

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

JSON Is The New Data Transfer Object (DTO)

The JSON processing API comes with Java EE 7 and is already integrated with JAX-RS. JsonObject and JsonArray are serialized and deserialized by the JAX-RS runtime without any additional effort.

JsonObject is a Map<String, JsonValue> and so a generic and dynamic DTO.

Because the entities know their state and also have access to private data, the JSON-mapping happens directly within the domain objects:

    
public class Workshop {

    private String name;
    private int duration;

    public Workshop(String name, int duration) {
        this.name = name;
        this.duration = duration;
    }


    public Workshop(JsonObject input) {
        this.name = input.getString("name");
        this.duration = input.
                getJsonNumber("duration").
                intValue();
    }


    public JsonObject toJson() {
        return Json.createObjectBuilder().
                add("name", this.name).
                add("duration", this.duration).
                build();
    }
}
    
    

Now the JAX-RS resource class only has to invoke the entities method to map from and to the JsonObject representation:

        
@Stateless
@Path("workshops")
public class WorkshopsResource {

    @Inject
    RegistrationStore store;

    @GET
    public JsonArray all() {
        JsonArrayBuilder list = Json.createArrayBuilder();
        List<Workshop> all = this.store.all();
        all.stream().map(Workshop::toJson).forEach(list::add);
        return list.build();
    }

    @POST
    public void save(JsonObject input) {
        this.store.save(new Workshop(input));
    }
}
        
    
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

Asynchronous WAR To WAR Communication With WebSockets

WebSockets come with Java EE 7 and require no additional dependencies or libraries. Particularly in "microservices architectures" websockets are an interesting option for the implementation of WAR to WAR communication.

In this screencast I created two WARs from scratch and let them communicate via WebSockets:

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

Creating A CustomElement (WebComponent) From Scratch

Building a native, vanilla, HTML 5 Custom Element (a WebComponent standard) without any external dependencies from scratch:

Polyfills are available for older browsers.

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at JavaScript and WebEssentials Workshop


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

60k eBills per Hour, Tiny WARs -- Or Java EE 7 In Mass Billing and Public Services Market in Slovenia

Aleksander, please introduce yourself

My name is Aleksander Bastl and I am a software engineer that has more than 30 years of experience in software development. I'm currently working on a PhD on the topic "Using the IOT devices for bridging the gap between Smarthome and SmartGrid". I am also president of the software vendors section in the "Chamber of Commerce and Industry of Slovenia", where I led a working body for the preparation of a national standard called e-Slog 1.6.1., which has since been accepted and now defines the legal basis of electronic exchange of invoices in Slovenia. https://e-slog.gzs.si/vsebina/e-SLOG-dokumentacija-za-XML-enostavni-ra%C4%8Dun-verzija-16. At the moment I'm also one of the few Vaadin certified engineers in Slovenia. I founded "Vaadin Meeting Group Slovenia", where Slovenian Vaadin users can exchange their experiences www.meetup.com/Vaadin-Slovenia/. I am also the owner and manager of a Slovenian company Bass d.o.o. (www.bass.si), where I am actively involved in our development cycle from a business perspective. We are well-versed and specialized in mass billing systems such as public water services, garbage collection, gas, heat, waste water... We have been in this particular business for more than 25 years and in this segment we currently cover more than 2/3 of the Slovenian market.

You told me during the airhacks, you are a founder of several companies. Are all companies using Java EE?

Companies Bass d.o.o (www.bass.si) and Ring d.o.o ( www.ring.si ), which are involved with development of new mass billing software are using Java EE 7. Using java EE we have developed quite a few solutions. To name a few examples: a paperless business environment, that can be used as a full cloud solution with personal certificates for security (BassDok), a time record for employees, a mobile work order program that is accessible with a tablet etc. Novatel and Eurotel (www.novatel.si , www.eurotel.si) are involved with VoIP technologies. We are developing software in Scala - also a JAVA derivative. We put special emphasis on better responsiveness, so we use more process oriented software that can handle transit for VoIP exchange with a few thousand parallel VoIP channels at once.

What are you currently building with Java EE?

At the moment we are developing several projects. Salary accounting (which is complex from a legal aspect), information portal for utility services, invoices with massive PDF generation (500.000+ monthly), mass billing used in public services (Developing new generation in JAVA EE)...

Can you share with us some geeky numbers like e.g. TX per seconds, heap sizes, thinnest WARs etc -- whatever Java EE devs might find interesting.

Java EE enables us to write highly scalable and compact programs. I find our electronic Invoices very interesting, since despite being one of the biggest providers in our country, our business logic part of WAR is less than 6MB big and without load balancing a virtual machine with a configuration of 12GB of ram and 4 cores is capable of around 60.000 transaction per hour if the eBill is not larger than 500 KB (normally they average around 300KB). Our Salary accounting business logic is only 350KB and 9MB with Vaadin UI.

Are you happy with Java EE so far? Is Java EE productive?

Yes im very pleased with Java EE 7 so far, because our main focus lies in the business logic, for which we invest a lot of time. Using Java EE results in a very fast development cycle and its usage enables us to write compact and readable code. We are also very pleased with UnitTesting, because it helps us release better products for our users.

Which application servers, tools or IDEs are you using?

We are currently using Payara. Our migration to it from Glassfish was smooth. For developing, we are using IntelliJ and Vaadin.

How important are standards for you? Does your application depend on application server specific APIs?

Java EE standards are very important and we follow JAVA EE 7 standards. Our applications are not dependent on application server specifics, we are very strict and use only on Java EE 7 specifications which are more than sufficient for our needs. With this strategy we are fully JAVA EE server independent.

Which Java EE APIs are your favorites?

JAX-RS, JPA, EJB, CDI (@Inject)

You attended the airhacks.com several times. Did you had the chance to chat with other attendees during the airhacks? If yes, what was the most interesting project / problem / use case in the workshops?

Yes we talked with other training participants about our and their projects and exchanged some ideas and benefits of JAVA EE.

How much code have / external libraries you deleted after the airhacks workshop? :-)

Every time we come back from an Airhacks workshop we have a fresh look on how to code in Java EE. We actually attended Java EE bootstrap and Java EE effective workshops before we started first big projects in Java EE, which helped us to differentiate between do's and don'ts very early in the development. We adopted and applied BCE patterns from the very beginning with very few external libraries except Vaadin framework for UI. With later visits of workshop we managed to simplify development cycles with simple tricks that were shown, like using abstract classes and simple unit tests. We have been coming back ever since to find out about new technologies and to strengthen our confidence that we are on the correct path.

Can you share any resources (blogs, etc feel free to promote yourself) with us?

In Java EE7, we have developed and manage a processing center for the exchange of e-invoices ( www.procesni.center), which received EuroCloud award in category "Best cloud solutuion for horizontal market". Online portal designed to end customers of public service www.komunala.info. A user can find out about the state of meters, review account message, payment status, download e-invoice schedules of waste collection, service contract ...

Aleksander, thank you for the interview!


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

Launching Java EE Thin WARs In The Clouds

Java EE (Full Profile) and Thin WARs are particularly suitable for cloud deployments. In this screencast I created from scratch, built (with Maven) a Java EE 7 Thin WAR and pushed the operating system (Cent OS 7) with JVM, Payara Application Server and the WAR to the clouds of jelastic.com.

After deploying it, I created an environment and started the application. Everything took ...6 mins.

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

Upcoming Cloud, Microservice, Web and Java EE Events

  1. (free) Cloud Native @BMW, Munich, 24th January 2017, 8:15pm, "Live-Hacking: Microservices und HA-Patterns"
  2. (free) 35th / 2.2017 airhacks.tv, 6th February 2017, 6 pm CET, live Q&A streaming. Any questions left about Java (EE), Web, Architecture and Co?. Ask now: https://gist.github.com/AdamBien/4791c4a5e8f06b0b8772ab6df6772001
  3. Voxxed, 25th February 2017, Geneva / CERN (!!!), "Microservices on Java EE — As Cool As The LHC"
  4. Voxxeddays Bucharest, 10th March 2017, "Serverless HTML 5 Apps With Angular 2, React, Polymer 2.0 and Java EE Microservices"
  5. airhacks.com, 13th March 2017, Airport MUC, Workshop: "Building (=understanding) HTML 5 / ES 6 web applications without frameworks" [a little bit Polymer 2.0 included :-)]
  6. airhacks.com, 14th March 2017, Airport MUC, Workshop: "Building HTML 5 Applications with React"
  7. airhacks.com, 15th March 2017, Airport MUC, Workshop: "Building HTML 5 Applications with Angular2"
  8. airhacks.com, 4th - 6th April 2017, Airport MUC, Workshops: "Java EE 7 Architectures, Java EE 7 Microservices and NEW: "Java EE 7 Performance, Troubleshooting and Monitoring"
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

Importance of Java EE, JCP, Java EE Guardians and Microprofile--Interview With Reza Rahman

Reza, please introduce yourself

I am just a professional server-side Java developer, architect and consultant. I have been involved in the Java EE community for a long time (about 15 some years now). For folks interested, a long version of my bio is on my LinkedIn summary. For most readers here, it's probably significant that I am the former official Java EE evangelist at Oracle and a long time contributor to Java EE JSRs in the JCP. My humble blog is here. I also try to do something useful with my personal Twitter account. As a relatively frequent speaker, I try to share pragmatic Java EE code on my GitHub account.

Which application servers, tools or IDEs are you using?

Like most Java developers I use a wide variety of things including Java EE, Spring, WebSphere, WebLogic, JBoss, GlassFish/Payara, Tomcat, Spring Boot, Eclipse and NetBeans. My clear favorites these days are Java EE, WildFly, WebSphere Liberty and NetBeans. I think WildFly Swarm is a really cool project. I am a little sad to say I had been a long time fan of GlassFish and to a lesser extent I still am. I think TomEE has a lot of yet unmet potential and could be a significant player if the right things are done.

You are the chief Java EE Guardian. How big is the Java EE Guardians community? Who else is involved?

I don't think there is actually a chief Java EE Guardian (and I hope there will never be). From the very start the core folks involved have had a gentleman's agreement to remain a very egalitarian community where everyone is treated absolutely equally. We try our best to operate under open collective consensus based decisions. It is certainly fair to say I am a key Java EE Guardian responsible for bringing our community and concerns to the open. It is also equally fair to say the core Java EE Guardians started their most important work together far before I had anything to do with it.

I would say considering our age, the Java EE Guardian community is quite large. Our full list of supporters are always available on our web site. Without needlessly naming names, our support comes from fifty JUGs, about a dozen official Java Champions, forty some JUG leaders, many JCP members, bloggers, authors, speakers and educators. One name I think is fair to mention is James Gosling - the father of Java. Most importantly, many ordinary Java developers choose to support us. There are well over 3K signatures on our change.org petition to Oracle executives on Java EE. About 4K people follow us on Twitter. There are over 600 people subscribed to our Google Group account. There isn't a heavy Java EE vendor presence in our community. I think that's a good thing.

None of this means we do not still need more support. The broadest possible support will help us achieve our mission faster, more effectively and ensure that the results of our efforts last a very long time. We are a grassroots organization. Our only job is to serve the best interests of the Java EE community. The most important voice that matters for us is the ordinary Java developer, particularly people that see the need to keep vendors on the Java server-side accountable for their words and actions.

What is your opinion about the Microprofile?

I think MicroProfile is a very important and timely initiative. The issue is that it is very difficult to separate hype from reality in microservices. I already see a number of clients struggling under the weight of vendor driven microservices hype. I fear a lot of these projects are headed towards needless failure by buying into hype driven products too quickly. Java EE is facing the same issue. There is a very real danger Java EE may wind up prematurely standardizing many features that in the end will not stand the test of time in a few years. The MicroProfile is a great way for Java EE vendors to pseudo standardize microservices features and market those features into their products without risking polluting Java EE too much with a bunch of yet unproven ideas (or worse, outright bad ideas that happen to be trendy for a moment).

MicroProfile also serves as an important reminder to Oracle that it does not have a monopoly on standardization in server-side Java. If it fails to be a good steward for Java EE, an alternate standard can and will be naturally formed.

Lastly, MicroProfile is a good antidote to some of the deliberately designed Java EE bashing some vendors engage in (I think we all know who these vendors and individuals are). They know fully well that Java EE tries to do the right thing by avoiding hype-driven features. They take advantage of this principled and disciplined standardization approach by continually claiming Java EE is "not relevant" because it does not immediately jump on the hype of the day. Things like MicroProfile are great because it allows vendors that embrace Java EE to still take part in the hype bandwagon in their products without destroying one of the core value propositions of standards as a critical insulator against vendor hype.

My only current concern with MicroProfile is the potentially needless duplication of effort with what Oracle has announced for an accelerated Java EE 9. I hope the people involved with MicroProfile are keeping a cool head and properly negotiating and collaborating with Oracle, even if it is behind the scenes. Whether we like it or not, any standardization effort without a major vendor like Oracle is weaker, not stronger. It is also a Herculean and perhaps Quixotic task to try to re-create the JCP. Given an opportunity, I know Oracle has the resources to do the right thing for it's business and the community. Like anywhere else, there are plenty of idiots at Oracle. The way to make sure the idiots are not too empowered is by working with the right people still inside Oracle.

Why Java EE is important?

Java EE is so important it is very difficult to explain its full significance in the span of a single interview. As soon as time allows I plan to blog about this very topic soon. The topic is timely because it is very poorly understood by most developers and that's very dangerous, especially with certain vendors taking a deliberately anti-Java EE stance to advance their own proprietary business agendas - especially on the cloud.

The most obvious critical function for Java EE is that it is the only open standard we have for server-side Java. That's been the case for a very long time and hopefully will remain the case for many more years. Without Java EE you have two very bad possibilities - one far worse than the other. The lesser of the two evils is a bunch of competitors that don't really collaborate and have basically incompatible products. In such a scenario developers are basically locked into a given vendor. If that vendor turns out to be the wrong choice for any reason you have to pay a very high cost of porting all the APIs your application uses. By far the most terrible situation is that the entire server-side Java ecosystem is left to the mercy of a single monopoly vendor with no viable competition. All this is even worse on the cloud since you are locked in not just at the API level but also at the infrastructure level.

By contrast what Java EE enables is a set of uniform APIs that are shared across vendors and implementations. Vendors can effectively compete on implementations, quality of service, price and extensions. Developers are far freer to choose between vendors at will. This is the model that has enabled a robust server-side Java ecosystem for a long time. Developers should be genuinely frightened of what will happen to Java without an important competitive safeguard like Java EE in place.

What is your opinion about JCP?

I have worked inside the JCP for a very long time and honestly have only good things to say about it. I felt I had a real impact, people that really care collaborate openly on the expert groups and the rules that govern the JCP makes sure everything happens in an open, transparent way. This is in sharp contrast to open source projects I have seen. Such projects are open in name but in reality are completely controlled by a small set of committers (often even just a single dictatorial committer). By far the biggest problem with the JCP that I have seen is that not enough developers take the time to participate or care.

That is not by any means to say that the JCP is perfect (let's face it - nothing in real life is). Oracle definitely needs to open up more and relinquish more control of the JCP and Java. Participating in the JCP and implementing Java standards needs to be easier. The only way any of this will happen is by participating and working with Oracle. Having a more open and vendor neutral Java is in the interest of every developer. It is worth the effort and worth trying.

Oracle announced at JavaOne releases of Java EE 8 and Java EE 9 for the next two years. Did the announcement surprised you?

The fact that Oracle would be forced to recommit to Java EE does not surprise me at all. The underlying long-term fundamental financial factors really made what Oracle had been doing for a few months quite mindless. It is the result of the over-empowered idiots at Oracle that I alluded to earlier. Hopefully these people have now learned their lesson and the right people inside Oracle have been empowered to do the right thing for the community and Oracle's business.

What surprised me is the speed at which we were able to get Oracle to recommit. The problem with idiots is that it is hard to get them to admit they were wrong. It is possible these people were side-lined when decisions at Oracle were corrected once the right people with adequate authority figured out what was going on.

How Java EE 8 is doing? What is the progress?

At the moment Java EE 8 is looking quite good. Although we have not yet formally updated our public tracking data, anecdotally it looks like there is a significant up-tick in overall activity from Oracle. It may even be possible Java EE 8 will be delivered sooner than Oracle has promised. I think this is the right point to forgive Oracle's past mistakes and refocus on what they are doing right and can do right as the Java steward. That does not mean of course that we do not keep our ears and eyes open.

Can you share any resources (blogs, etc feel free to promote yourself) with us?

The best thing developers can do is stay tuned to the Java EE Guardian Twitter account and Google Group. Those are our main open coordination mechanisms. We need everyone's help to keep moving Java EE forward. No support is too big or too small. As we have shown already, the grassroots community working together can achieve remarkable things vendors can't even begin to imagine. Together humble server-side Java developers can ensure their interests are preserved above all.

Reza, thank you for the interview!


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