Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy link

danilopiazza commented Aug 4, 2015

Hi Adam,

I've got some "custom" authentication mechanism in place (essentially: user credentials are provided by an external service); I would like to create my own instance of security Principal, have it injected into the EJB SessionContext, and get it back when I call SessionContext.getUserPrincipal().

After reading [Secure Java EE Authentication]( and watching) on Java Magazine and watching the follow-up screencast, I've been trying to prepare a proof-of-concept example using both Glassfish 4 and WildFly 8, but I ended up fighting against Weld about the default implementation of

Any suggestions? Should I even try to replace the default security Principal, or should I limit myself to injecting a completely unrelated object, as you showed in your screencast?

Copy link

nazmuddin commented Aug 6, 2015

Hi adam,
I am building an simple application using afterburner but i got some issues. can you please help me with This. ""
Thank you.

Copy link

bombay1982 commented Aug 9, 2015

Hi Adam,
Would you recommend Java EE as a technology for a start-up company(streaming movies type of startup) ?

  1. If yes, why Java EE(pros & cons) for streaming movies type of startup? Would you include any frameworks to speed up work? Either Play or Spring are worth to learn to implement in the project ? I'm not sure what advantages would frameworks give it to me instead of clean Java EE7. Java frameworks market is so de-fragmented that it is very hard to learn them all.I did read about pros&cons of play and spring, but I wish to listen you opinion about it.
  2. Our plan is to allow stream up to 10000 unique users in first 12 months after launch. However it must be scalable to handle higher traffic in the future(average 1h of streaming video file per day).
  3. What library would you use to deal with video streaming in java ee ?

What other technology stack would also take under consideration for this type of purposes? Some people suggest python/django or ruby/rails for a quick development.
At the moment:
no 1 java ee + java framework? + js on the front end
no 2 python + django

Thank you in advance if your reply.

Copy link

blacksmithbrew commented Aug 10, 2015

Hello Adam,

I have got a question regarding UI development with JavaEE:
Do you recommend using JSF for productive applications ? Is there a threshold of quantity of users when one should think about alternatives to JSF ?
Which frontend technology can you recommend besides JSF ? The thoughtworks tech radar for example explicitly discourages from using JSF for new projects ( !
Is plain JSF2.2 + bootstrap a good choice ? What about Primefaces ? Also starting with AngularJS now is probably not a good decision !? What do you think about dukescript ?
So sorry for the bunch of questiins but basically I am struggling with having a good strategy finding the right UI framework...

Many thanks in advance,

Copy link

szlachet commented Aug 12, 2015

Hi Adam,

I have watched one of your session and there was something like that:
public Consumer expose(InjectionPoint ip) {
return Logger.getLogger(ip.getMember().getDeclaringClass().getName())::info;
Can you explain how it works? I wonder why we can return Consumer and how it happens that info receives Supplier or String. Thanks in advance.

Copy link

viktorcitaku commented Aug 16, 2015

Hi Adam,

  1. What do you think about ?
  2. Can I mix somehow MVC and ECB ?
  3. When using ECB pattern, where should i put the Data Model and View Model ?
  4. What is a Component at your perspective? example below =>
    componentOne ==> Entity/Control/Boundary
    componentTwo ==> Entity/Control/Boundary

Thank you :-)

Copy link

rajeshduggal commented Aug 20, 2015

Hi Adam, Raj from Toronto, Canada here!
I'm ready for a fresh computer setup at home. I generally like to dev in my home office, and then in the evening I like to dev at the dining table. So I'm not sure if I should go with a complete high-end desktop setup for the home office and also a basic laptop to connect by "remote desktop" to the desktop in the evenings. Or perhaps I should just buy a high-powered gaming / desktop-replacement laptop. (e.g. The MSI Ghost Pro laptop looks fun) with an additional monitor/keyboard/mouse for my home office. Or perhaps a LTSP (Linux Terminal Server Project) setup is right for me. I don't know.

You've mentioned that you build a high powered computer system every few years. I'm really interested to learn more details how you use it in your dev setup and about which computer systems or parts you will likely be buying next, and if you have some specific websites you look to buy these systems/parts.

Copy link

marcincembrzynski commented Aug 25, 2015

Hi Adam,
How can I use CDI in @FacesConverter?

Copy link

lars1974 commented Aug 31, 2015

Hi Adam,

We are currently evaluating an ESB (Mule) . We would like to use it as a message broker between our services. We are also talking about using it to develop services that contains a lot of mapping, orchestration or flows. Maybe even plain business services instead of using our primary platform java EE. There is a lot of arguments flying around like: "Faster to develop-", "Easier to understand for developers-", "Easier to maintain-" and "more lightweight-" than core Java EE. Do You have any pros and contras about ESB's for these purposes?

We also think about using the Mule API Gateway, for analytics, logging, dynamic url-mapping etc. Any thoughts about that?


Copy link

jayadipjadhav commented Aug 31, 2015

Hi Adam,

Does JavaFX follows Passive View MVP design pattern as identified by Martin Fowler?


Copy link

deetewari commented Sep 2, 2015

Hi Adam,
We use TomEE with APR (using compiled libtcnative) on a lot of production boxes and often there are problems when TomEE just doesn't seem to accept connections. JPS and TOP show the main java process as active and doing curl to the appserver locally seems to get upto the connected state and then no response is sent back. A restart of the app server usually solves the problem. The problem seems to happen after every few hours of continuous usage.

I have tried using JMC to see if we can get some insights into whether our JavaEE7 web app gets stuck and figure out where and why. JMC seems pretty complex so I was wondering if you could throw some light on how to debug remote running app servers and webapps and what would be your tools of choice for such exercises and ideally what keys points to look for.

Another area on which I would love your comments is what is the best way to do ProcessBuilder delegations from within a webapp. I know this is typically not recommended but we need to do this from within the webapp as the webapp needs to call a few OS specific programs to do some low level stuff.

Our web app uses many SLSBs along with a few Singleton beans.
Thanks & looking forward to your answers and comments.

Copy link

haisi commented Sep 3, 2015


You properly mean something like:

public class LoggerConfigurator {
    public Logger produceLogger(InjectionPoint ip){
        Class<?> requestingClass = ip.getMember().getDeclaringClass();
        return Logger.getLogger(requestingClass.getName());

The @Produces tells CDI that this method will return a bean of instance Logger that should be in you DI-Context (meaning making it injtectable in other parts of your code).

InjectionPoint ip makes the caller availabe in the method i.e. you know in your producer-method information about the injector. This is handy, because now you can create a logger by simply injecting it. The producer will automaticly create the correct Logger with the right class name.

class MyClass {
    Logger log;

    //Same as
    Logger log = Logger.getLogger(MyClass.class.getName());

Copy link

masumcse1 commented Sep 4, 2015

I have confusion that why use EJB over cdi .
From clustering , production specific is there any advantage of Using EJB ?
please give me some points : why Use EJB over cdi ?

i have good theoretical knowledge (EJB and CDI) but i can not make decision , which use case cdi /ejb perfect.
From my study .. i have found that
EJB model is perfect for = When need clustering , highly concurrent / transaction , security , timer , asynchronous process,
service integration , mission critical complex financial application , different application server pool.

CDI is perfect for = maximum case cdi is same as EJB . recent slogan is CDI is perfect for any
requirement of application . it fulfill all mission critical complex requirements.
recently, several consultant / forum /j2ee expert says that for all type of requirement CDI is enough , No need EJB .
For for this reason, i can not select which one is perfect CDI/EJB . Because from internet , i have
found ambiguous information about ejb/cdi. i develop a demo with two technology
(CDI 1.0/ EJB3.2) for wildfy , i have found same result . i think , technically cdi / ejb has some
difference(scope) but usage point of view , it has no difference .
Please give brief idea , from real life scenario.-----maintain or production environment(for large
financial environment - always works at a time 5000 user ).

1 .which case cdi is perfect ?
2. which case ejb is perfect ?

Copy link

gbourant commented Sep 6, 2015

Hey Adam ,
How to expose with JAXRS more than one Restful APIs which the one will be used internally and the other one publicly ?
Thanks in advance!

Copy link

Zavael commented Sep 8, 2015

Hi Adam, I am using afterburner in multipage application and I am curious what is the best approach to switch pages. Not sure if it was already asked - I discovered these gists just recently.

My idea was to have one root page with menu (this way menu is reused for all pages) and with content pane. The content pane instance will be passed at app start to some PageController.setContentRef(Parent root);
For example in this way I have dashboard as first content pane children with some icons/buttons. After clicking on icon, the PageController.showDetailA(); method is called from dashboardPresenter. The method clears children from content pane and add one specific children.
This children can have one Back button (that calls PageController.showDashboard(); and some controls to go even deeper in views chain (PageController.showDeeperDetailOfDetailA();) etc.

The PageController can have instancies of all pages, or recreate them every time (for now not sure what will be better).

Do you think there is better way to do this? For example using multiple Stage instances somehow? If so, could you please create some simple demo.

Copy link

haisi commented Sep 10, 2015

Whats the best way to handle errors/exceptions in JavaFX?
Lets say I call my service from the presenter and an error occurs. What is the best way to show an exception dialog to the user? Should I just wrap all my service calls in try catch blocks? What if I not not only want to show a dialog but also make further UI changes (e.g. mark textfields red etc.)?

Would you recommend using the Thread.setDefaultUncaughtExceptionHandler like in this stackoverflow answer?

Copy link

loocifer commented Sep 13, 2015

Hello Adam,

what do you think about the "reactive programming" thing ? There are a lot of people who think that JavaEE does not fit to RP. How do you see the future of JavaEE ?


Copy link

dsurendran commented Sep 14, 2015

  1. What is the best way to integrate microservices?
  2. Whats your thought on using Service Bus for integration?

Copy link

ghost commented Sep 14, 2015

Hi Adam,

in several talks you mention to host your blog on your own hardware.

  1. Could you please provide some more information about the concrete setup?
  2. How is this hardware connected to the internet? Which tarrif, which provider, which bandwidth? Can you recommend anything?


Copy link

atrifyllis commented Sep 14, 2015

Hi Adam!
When using an application server is there a way to "route" logs from the server components to my own log files? For example using wildfly when I want to log hibernate query parameters or cxf messages I need to configure a logger inside the application servero logging configuration and check the server's logs. How can I make the server log in my logs (preferably in a per-application manner). Thank you in advance!

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