Skip to content

Instantly share code, notes, and snippets.

Created July 7, 2015 05:40
Show Gist options
  • Save AdamBien/a0fedea018c96f43f33a to your computer and use it in GitHub Desktop.
Save AdamBien/a0fedea018c96f43f33a to your computer and use it in GitHub Desktop.
Copy link

Hi Adam, how do you deal with classpath conflicts in Glassfish? In my case, Glassfish 4.1 uses an older version Guava (13.0.1) and exposes it to applications. My app also has a dependency to Guava, but to v18. GF's version of Guava takes precedence and this results in NoSuchMethod errors when running my application. Setting the classloader delegate to false is not option, as this not allowed for applications that use e.g. EJBs (according to the Glassfish Application Development guide).

Copy link

Which application server would you use, if you started an app from scratch?

Copy link

Scenario: scaling up a 'war' to multiple payara nodes for load-balancing and fault tolerance. The load-balancer is nginx with sticky-session support.

  • Should we think about NOT to set up glassfish clustering? What would be the pros/cons for a cluster or independent nodes?
  • how to build a simple, but distributed and persisted request counter in a J2EE environment with solid performance? Let's say some data-loss is acceptable.

Copy link

What is your opinion of Apache Kafka? Have you used in your projects? Are there better options for a "stream-centric" or "central pipeline" architecture?
Thank you

Copy link

What is your preferred database?
Thank you again.

Copy link

The classpath issue you have sounds similar to one we've encountered
(related to, which is fixable by running:

asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=false

Copy link

Concerning Java threading in general it is well known to avoid it if you can. But if there is no alternative, which sources to you recommend for an introduction and staying updated. Having read "Java Concurrency in Practice" from Brian Goetz et al (focussing Java 6) it looks pretty difficult to test thread topics. Do you have any recommendations how to do that?

What is your opinion of

Thanks in advance for your time to answer and please keep up with your show. I really enjoy it!

Copy link

rszulgo commented Jul 28, 2015

It's always better to have the smallest war possible. My is about 50megs right now. Mainly because of lot of 3rd party jars from common libs. We use tomcat + jpa and websockets and some other jee stuff. Is it worth migrating to some real jee app server like glass fish?

Copy link

jieryn commented Jul 28, 2015

All my team's Java EE projects are Apache Maven projects, and they all tend to follow traditional multi-module style. With "domain" for JPA entities, "dao" for JPA->DB bridge, "service" for business logic, "api" for JAX-RS API, and "web" for user front end (angular/bootstrap).

We find we now want to use @EntityListener to easily feed a @websocket endpoint in the "api" module. However, the @EntityListener seems to be unfortunately designed in that it has to couple the listener implementation on the @entity itself, and thus cause a cyclic dependency because it makes more sense to us to have the @EntityListener implementation inside the "api" where it will be used to broadcast the message to all registered web socket clients.

We have seen a lot of benefit from maintaining separation of concerns within Apache Maven modules in the manner I described above. However our users will benefit quite a bit from having the ability to have a @websocket /api/websocket/entity/events which can be used to subscribe for real-time updates. Would you please offer some recommendations to fit in our current design? Is there a better approach than using @EntityListener to provide the real time stream of events? Any other gotchas you have experienced for this type of thing? Thank you!

Copy link

oedemis commented Jul 28, 2015

Hi Adam

How you structure your front-end with JSF or JS Frameworks?
Follow you also a pattern like ECB for back-end?

Copy link

rangalo commented Jul 31, 2015

Hello Adam,

How to conform to YSlow rules using JSF ? Can we use some cdi, interceptor magic here ?
You don't need to go though all the rules. I just want to know the basics.
For example expires headers and tagging the images, js and css files with timestamps, how to go about it ?

Copy link

meshuga commented Jul 31, 2015

There are questions about Kafka and Akka, so I want to ask you about your opinion about Vert.x.

Copy link

hello adam,
i have some questions concerning the actual situation about open source and production ready JavaEE-AppServers.
.) In previous days I could use glassfish in production without costs but i could decide to pay for a production license too. That was fine. Today with Wildfly I have a similar situation. I can develop and run wildfly in production, but when i want to pay for a production license, I have to switch to Jboss EAP (which is not available yet for JavaEE 7). As a consequence I have "diffferent" products (Wildfly and Jboss EAP). Is this correct? Or do i miss something? (is here a similar situation with TomEE?)
.) Websphere Liberty Profile has a similar situation compared to glassfish, but i have a restriction when using in production without a payed license (2 Gig?).
.) With Docker in mind I see the Liberty Profile especially designed for docker use (lightweight, fast, modular, ...). What about Wildfly and TomEE in Docker use? There exist no "special" docker versions.
Does that mean, that they are dockerable enough out of the box? Do there exist Benchmarks or other technical infos when comparing multi ear's/war's Applications on one AppServer on Docker with one ear/war/AppServer/Docker-Architecture? (i mean an application, consisting for instance of 10 ear's/war's. On the one hand, I can use one AppServer inside a Docker Container for all 10 ear's/war's. Or I take for each ear/war one AppServer inside a Docker container. So i have 10 parallel AppServers inside 10 docker containers).
thanxs in advance, andy

Copy link

ghost commented Aug 11, 2015

Hello, Im new to JAX-RS approach and i've a particular questions. can anybody answer?

I've a method like following in a service class

    public Response listUsers( //PaginatedListWrapper
            @QueryParam("page") @DefaultValue("1") Integer page,
            @QueryParam("sortFields") @DefaultValue("id") String sortFields,
            @QueryParam("sortDirections") @DefaultValue("asc") String sortDirections) {

        PaginatedListWrapper listWrapper = new PaginatedListWrapper<>();

        int start = (listWrapper.getCurrentPage() - 1) * listWrapper.getPageSize();
        listWrapper.setList(userFacade.findRange(new int[]{start, listWrapper.getPageSize()}));

        return Response.status(Response.Status.OK).entity(listWrapper).build();

my PaginatedListWrapper class like follows

public class PaginatedListWrapper {
    private Integer currentPage;
    private Integer pageSize;
    private Integer totalResults;
    private String sortFields;
    private String sortDirections;
    private List list;

and im getting output like the following

Object {
currentPage: 1, 
list: Array[2],
0: "[ id=1 ]"
1: "[ id=2 ]" 
pageSize: 10, 
sortDirections: "asc", 
sortFields: "id"…

why im not getting the list of users as json object? like array of objects [{}, {}, {} ...]
what im missing here?
other than using jersey or jackson, i want to learn the underneath core stuffs of doing this.
in my maven it just javaee-web-api and eclipselink

Copy link

ghost commented Aug 12, 2015

Anyone please ?

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