Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Ask questions and see you at May, 13th (this time one week later), 6.PM. CET:

Also checkout recent episode:


Please keep the questions Java EE-stic. Means: as short and as concise as only possible. Feel free to ask several, shorter questions.

Dates for (cloudy) winter 2019 are available.

Copy link

vasilaio commented Apr 16, 2019

Hi Adam,

  1. Is there any real benefit to mark all the rest endpoints as @Singleton? According to this link, the difference between the tests is around 1.5% and per-request test is using more memory. Is there any real example when 'singleton endpoints' are bad practice? Also I saw that you used it in lightfish project.
  2. How can I produce/inject a cdi bean into a resource endpoint based on deployed application server. For example, if my application is deployed on wildfly I want to inject WildflyService, if it is payara then PayaraService. Both of this services implements same interface.
  3. Is there any way to pay for your courses by bank transfer? I don't have a credit card.

Thank you very much.

Copy link

srnjak commented Apr 20, 2019

Hi Adam,

I have question about emitting events in microservices. I understand that XA transactions are not desired, which I used to achieve "exactly once" delivery in Java EE. So I'm thinking about "at least once" strategy.
What is the best way to accomplish this using JEE and Microprofile?
My current solution is to store event in the local database. Then timer triggers processing that event and send it to message broker. Is there better solution? I see disadvantage in timer, because of delayed processing.

Thank you for your opinion.

Copy link

Tunjidir commented Apr 21, 2019

Hi adam? How would one implement JavaEE/JakartaEE security assuming the IdentityStore is meant to fetch Principal details from the database?
what server directory does one copy persistence.xml and sql script that's loaded by persistence.xml to when deploying with docker using payara5, and it's h2 embedded db or apache derby? thank you

Copy link

dinabogdan commented Apr 25, 2019

Hi Adam,

Currently I'm developing software using Java + Spring Boot but I like JavaEE and I want to try it more and maybe move with JavaEE into production. I want to ask you about using Kafka in a JavaEE application, is there any API provided by the JavaEE such as Spring-Kafka? The Spring-Kafka API is a very easy to understand API despite the very complicated Kafka Configurations. Thank you a lot!

Copy link

senleft commented Apr 25, 2019

Hello Adam,
One of the typical thing in the distributed systems is network failures.
Case 1.
Stale DB connection in the connection pool or an intermittent network error will fail the DB transaction. The repetition of the DB operation may be successful.
Case 2.
Service to Service communication network failure (e.g. via REST). No DB transaction involved. The repetition of the service call may be successful.

Available solutions.


1st and 2nd solutions - additional dependency. Not a part of the platform -> no integration with Transaction Manager (Case 1).
3rd solution - part of platform* (not JEE but Microprofile). No idea if it integrated with the Transaction Manager.

What approach do you recommend to handle an intermittent error for the above cases (especially the case 1)?
Thank you!

Copy link

orlovskyjavaprofi commented Apr 25, 2019

Hi Adam, as freelancer myself currently i am very concern about state of commercial support for different versions of JDKs from different vendors.
JUG Dortmund Lead, Java Champion, JavaOne Rockstar Hendrik Ebbers has given a talk at local meetup group in Nuremberg about changes in Oracle JDK license subscription program.
So he explained that if three major JDK Vendors find a bug in their commercial JDK version they fixed and commit the patch to own private version source control and then if they suppose to commit to openJdk this probably can cause an issue, because different JDK Vendors have different release cycles.
Lets just imagine following situation:
Vendor A find a bug in own commercial JDK 17th and fix it and commit it for version 18 of openJDK and at the same time Vendor B find the bug in version 18 and released the commit to openJDK 19 and at the same time Vendor C find a bug and fix it and released it in openJDK20 and lets suppose that the bug which was fixed by all the vendors is one and the same, then it's obvious question who will decide which of the patches is a right and appropriate one for the openJDK?
Sure for commercial clients which use the commercial version of Java JDK of one or another Vendor its ok, but what about middle size enterprises and start up company's, i know for the fact ,that this can probably caused a financial damage (switching to commercial version of jdk) to such company's, i decided to recommend to my client's to slowly switch and use because its really free and include all fixes which will be found by RedHat i mean by IBM. This is not ideal situation for JDK as platform, because adoptopenjdk does not have a TCK approval of standard.
So what is you opinion about such fragile Java Platform state, what kind of advise we should give our clients late in the future? I sincerely hope that big company's realize , that they created a mess and without any common sense "write once , run everywhere" will definetly become a thing of past.

Copy link

dsurendran commented May 2, 2019

Hello Adam,

  1. I am writing an OAuth client, what is the best practice to get a refresh token in Java. We need to fetch after get 401 unauthorized or to cache the OAuth token and request for refresh token before timeout period? Is there is an out of box library support?
    Thank you.

Copy link

g-mccarthy commented May 5, 2019

Hi Adam,
I am just wondering if you were setting up an enterprise system, what kind of architecture you would use i.e. API Gateway, Docker, Kubernetes, Openshift, MQ, etc. Could you describe at a high level how calls would flow through the system. I am planning to move from an older monolithic application that communicates with many external systems to a more flexible service based system. I have some ideas of what I would like to do but would be very interested in hearing your thoughts.
Thanks in advance for any advice,

Copy link

ghassen-chetioui commented May 6, 2019

Hello Adam,
Can you tell us your thoughts concerning the update of JakartaEE Rights to Java Trademarks
Thank you.

Copy link

dineshbhagat commented May 6, 2019

Hi Adam,
It would be great if you share tips to understand existing codebase(both open and closed source - with less or no documentation).
Most of the time, it feels information overload and loses interest in reading code. This is holding me back in contributing to open source code.

Copy link

tmsanchez commented May 6, 2019

Hi Adam.

Now that Jakarta EE Rights from Java Trademarks are finally defined, in your opinion, What will be the future or Jakarta EE? (I notice that Ghassen already ask same question)


Tito Sanchez

Copy link

mreppe commented May 7, 2019

Hello Adam

How do you handle garbage collection of ViewScoped beans in JSF in your project? In the current JSF version ViewScoped beans remain in the memory, if you leave the page with a GET request (h:link, h:outputLink, ...) instead of JSF navigation [1]. Due to this behavior we need a lot of heap space in our application, even if there are only a few users logged in. Do you use ViewScoped from Omnifaces to prevent this problem?


Regards from Austria

Copy link

jmlclosa commented May 7, 2019

Hi Adam,
Question about JavaFX :) which seems a forgotten think in "Java world" because majority of applications are web.

  1. What are your thoughts of using JavaFX/OpenJFX for standalone application on an embedded device? We are developing software for devices for a new public transport system: a driver console (x86), a smart card check device with screen (arm), unattended ticketing machine (x86), ...
    It has high interaction with hardware (card reader, credit card reader, qr reader, printer, gps, ...). It has a local database (using Hibernate) where all data is saved and is sent periodically to central system via REST (using Jax-RS)
    I miss the producitivity that I used to with Java EE: CDI, JTA, JSF, ... but I discard the use of Java EE application with application loaded by a Browser because I didn't rely on Browser interaction and there is no multi-user access.

  2. Do you recommend some framework like ControlsFX?
    We are using Afterburner.fx, which allows us using CDI and remove some boilerplate code for loading resources. We also added FontawesomeFX project.

  3. How do you think is the best way to communicate with that devices? I.E: force a reboot or getting trip info remotely.
    Maybe having a Java EE application inside the device with Jax-RS endpoints which communicate to JavaFX app via RMI?
    Central system --REST--> Java EE application in devices --RMI--> Java FX Application

Thanks for all your work, I've made first 4 online training and I don't miss any airhacks and podcast :)
Regards from Mallorca,

Copy link

dempile commented May 8, 2019

Hi Adam,
When I try to inject a microprofile metric like @counted in a cdi bean with @nAmed I got this error : cannot produce unserializable instances for injection into an injection point that requires a passivation capable dependency.
the cdi bean implements Serializable

Copy link

ivanzorcic commented May 9, 2019

Hi Adam,

I tried out some with JavaScript frontend (no framework no migration). If you want to take a look at it: (With this Application and a football table you can have an endless competition)
Would be great if you have time to review it and a question is:

How do I get @javax.ejb.Startup behavior without ejb but with cdi, so some method can be eagerly executed on startup?

  • using "@observes @initialized(ApplicationScoped.class)" throws when injecting EntityManager an exception "Unable to identify the default PU:"
  • quarkus provides an cdi event, which seems to work "io.quarkus.runtime.StartupEvent", but that is not part of a spec...

Regards from Darmstadt, Ivan

Copy link

altuga commented May 13, 2019

Hello Adam,

Should we write jars in war files or no jar(s) in a war file? I see some projects there are 5 war files and every 5 wars there are at least 3 or 4 jars file. In which use cases should we use jar files in war? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment