Adam Bien's Weblog

Security, Functional Java, React, TX, Docker Swarm, Dying MVC or 40th airhacks.tv

40th airhacks.tv is available (thanks to the 101 live viewers for the interactions):

Any questions left? The queue for the 41th airhacks.tv at August, 7th, 6pm CET is open: https://gist.github.com/AdamBien/90205a0717635f090c661bf2d24d4fe5

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

SimpleDateFormat, Java and Taligent Object-Oriented Operating System

The source of the class SimpleDateFormat comes with unusual copyright information:


(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
(C) Copyright IBM Corp. 1996-1998 - All Rights Reserved

According to Wikipedia, Taligent "...is the name of an object-oriented operating system, and the company that was dedicated to producing it."

After the efforts to build an object-oriented operating system failed, in 1995 Taligent became part of IBM and:

"...Taligent also created a set of Java- and JavaBeans-based development tools called WebRunner, a groupware product based on Lotus Notes called Places for Project Teams, and licensed various technologies to Sun which are today part of Java, as well as to Oracle Corporation and Netscape..."

Therefore: Java has also its roots in an object-oriented OS.

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

DerbyDB start fails on Docker -- Problem and Solution

An attempt to start DerbyDB 10.10.2.0 delivered with Glassfishv5 or recent Payara (asadmin start-database) will fail with:

 
Starting database in Network Server mode on host 0.0.0.0 and port 1527.
Unable to start database.  Please check log in /glassfish5/glassfish/databases/derby.log.

The derby.log contains the following exceptions:


Thu Jul 06 16:20:06 UTC 2017 : Security manager installed using the Basic server security policy.
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.enterprise.admin.cli.optional.DerbyControl.invokeNetworkServerControl(DerbyControl.java:158)
	at com.sun.enterprise.admin.cli.optional.DerbyControl.main(DerbyControl.java:245)
Caused by: java.lang.ExceptionInInitializerError
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.apache.derby.impl.drda.NetworkServerControlImpl.startNetworkServer(Unknown Source)
	at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown Source)
	at org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(Unknown Source)
	at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)
	... 6 more
Caused by: java.lang.ClassCastException: java.io.IOException cannot be cast to java.lang.RuntimeException
	at org.apache.derby.iapi.services.io.FileUtil.limitAccessToOwnerViaACLs(Unknown Source)
	at org.apache.derby.iapi.services.io.FileUtil.limitAccessToOwner(Unknown Source)
	at org.apache.derby.impl.services.stream.SingleStream.PBmakeFileHPW(Unknown Source)
	at org.apache.derby.impl.services.stream.SingleStream.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.derby.impl.services.stream.SingleStream.makeFileHPW(Unknown Source)
	at org.apache.derby.impl.services.stream.SingleStream.createDefaultStream(Unknown Source)
	at org.apache.derby.impl.services.stream.SingleStream.makeStream(Unknown Source)
	at org.apache.derby.impl.services.stream.SingleStream.boot(Unknown Source)
	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) 
    (...)

The exception is related to the issues: DERBY-6410 and DERBY-6503

Fix: update DerbyDB: recent versions are running on Docker without any issues, checkout docker image: Docklands DerbyDB image.

GlassFish v5, as well as, recent Payara Server (Issue #1738), are delivered with an old DerbyDB version. Thankfully the DerbyDB version can be easily upgraded just by overriding the folders: payara41/javadb glassfish5/javadb with the recent DerbyDB version. See e.g. the Docker image: Payara With DerbyDB.

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

Payara Server "Full", Autodeployment and Docker

Payara server comes with disabled autodeployment feature, what makes deployments at start in containerized environments, like Docker or clouds, more challenging.

Fortunately, Payara Server 172 introduced the --postbootcommandfile flag.

asadmin commands like e.g. deploy can be read from a file specified with the postbootcommandfile flag and executed after successful Payara's start, e.g.: asadmin start-domain --verbose --postbootcommandfile commands.txt. The postbootcommandfile feature makes deployments at boottime even more predictable.

All Payara-related docklands Dockerfiles are using the "postbootcommandfile" feature already. Also the hub.docker.com/u/airhacks/ airhacks/payara and airhacks/payara-derby were updated.

To start a Thin WAR (=kB) microservice, you only have to write these two lines in a Dockerfile:

        
        FROM airhacks/payara
        COPY ./target/micro.war ${DEPLOYMENT_DIR}
        
    

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

JASPIC, Lambdas, React, TX, JSF, MVC, JSON, Microservices, Docker Swarm, Threads or Questions for the 40th airhacks.tv

Topics for the 40th airhacks.tv at July, 3rd, 6pm CET:

  1. JASPIC for securing Java EE 7 applications
  2. Thoughts on lambdas and more functional Java
  3. Thoughts on AWS lambdas :-)
  4. The size of ReactJs -- and possible optimizations
  5. Thoughts on custom servlet login module
  6. How to handle transactions in Thin WARs
  7. Primefaces as "one stop" solution
  8. REST as communication "protocol" between Thin WARs
  9. WebSockets vs. Long Polling
  10. JSONObject as DTO and inheritance issues
  11. Microservices and Jenkins
  12. Opinions on Docker Swarm
  13. Threads and EJBs
  14. Is MVC dying (everywhere)?
  15. Programmatically deploy and undeploy Java EE applications

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

Unorthodox Enterprise Practices--at JavaOne 2015

Removing bloat with Java EE 7 (a JavaOne 2015 session):

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 -- 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

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