Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Last active December 6, 2017 16:44
Show Gist options
  • Save AdamBien/53ea02999adaa8c328af43c01583aa68 to your computer and use it in GitHub Desktop.
Save AdamBien/53ea02999adaa8c328af43c01583aa68 to your computer and use it in GitHub Desktop.
45thAirhacksQ&A.md
Copy link

ghost commented Nov 27, 2017

Hello Adam,

I am watching your screen cast about Java EE, Docker, and Cloud such as Openshift, Amazon, etc.
I have better understanding how to deploy Java EE on the cloud with Docker, but I'm still not understand how you handle the database connection? Did you also deploy the database inside Docker container or you're using Cloud Relational Database? Would you share your experience that elaborate Java EE and relational database on Cloud?

Thank you!

@Vagspath
Copy link

Vagspath commented Nov 27, 2017

Hi Adam,
Congratulations for the good work. I'd like to ask a question about a specific requirement i have in my project.
How can i have a transaction writing/updating to two different databases the same data? I whould like all the data to be persisted into two dbs syncrhonously. Should i look for XA Transaction? Any suggestion? (i'm using wildfly 8 and mysql).

Vaggelis

@mhoennig
Copy link

Hi Adam,

You already gave a kinda political answer to a similar question last month. But as you asked me on Twitter, to ask again, so I do:

How do you feel with the fact that the Java world does not have a solution for PWA with offline focus?

I think this is the toughest target environment for a Java developer as there is no official solution.


Let me add some more detail:

By your opinion, what's the Java way to implement a PWA with focus on heavy offline functionality and mobile devices?

Here some potential solutions:

a. for the programming language part:

  1. Transpilers (either of Java source- or bytecode)
    like GWT, JSweet, TeaVM or CheerpJ,
    none of them official nor enterprise traction though.
  2. Using JavaScript or, if sensible for the concrete application,
    any of it's derivants like TypeScript,
    thus, leaving the Java world.

b. for the GUI part:

  1. JavaFX ports to the browser (currently it just renders JavaFX
    on a server to be displayed in a browser, but an offline
    solution was announced).
  2. Using vanilla JavaScript DOM or JavaScript frameworks like
    React, Angular, Vue etc.

Where there is still no solution for the combination a1+b2 or the other way around, as far as I know.

For the case of answer 2 of either part: Isn't that kinda giving up Java?
Remember: I was talking about PWA with heavy offline functionality.
To me it seems, the Java world has no answer for this.

Thanks!
... Michael

@t-shaguy
Copy link

t-shaguy commented Dec 4, 2017

Dear Adam,

Thank you very much for all the wonderful work. Please I have a question relating to @suspended AsyncResponse response in Jax RS, now
I have my Restful Service call a MicroService implemented with JAX RS,

so I have this .

@post
@path("balance")
@JWTTokenNeeded // for JWT
public void doBalance(@suspended AsyncResponse, String reqtestStr)
{
Supplier balanceRequest = () -> baltarget.request().post(Entity.text(requestStr));
CompletableFuture.supplyAsync(balanceRequest, enquiry)// implementing bulkheads pattern @thanks to Adam Bien
.handle(this::doHandleResponse)
.thenAccept(response::resume).get(); // blocks
}

now balanceRequest returns the response object, I want a situation where I can manipulate the Response message (status and all that so I can propergate the response from balanceRequest to the caller , what happens now is the caller always gets the http status code 200. But my intention is to be able to control and define the http status and other components in the response.
Thank you

@Nurudeen
Copy link

Nurudeen commented Dec 5, 2017

Hi Adam ,
I am trying to encrypt form data "user name and password field " before sending to browser .
The form is in a jsp page posting the parameter to a servlet . I want to encrypt the form fields before calling the servlet class because these details always appear as plain text before reaching the application server .
I have https on my URL but these details still shows as plain text in the body of the request when users tries to login .

@tobciu
Copy link

tobciu commented Dec 5, 2017

Hi Adam,
in JavaEE8 how can i convert LocalDateTime to a json string so i can parse/use it in javascript?
Is there a posibility now to define a converter such as the AttributeConverter from JPA 2.1?
Thank you :-)

@dawuzi
Copy link

dawuzi commented Dec 5, 2017

Hi Adam,

I have noticed that a connection timeout exception when using JAX-WS on wildfly (10.1.0.Final in my case) has an javax.ejb.EJBTransactionRolledbackException as one of the underlying causing exception in the stacktrace. It then marks the current transaction as Rolled back even when the exception is caught and handled. The issue is that further actions executed afterwards which requires a valid transaction (especially database actions using JPA like create and update) would throw an exception saying that the current transaction has been rolled back.

I currently use a work around by invoking further actions using a method marked with the attribute @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) so it they can be executed with a valid new transaction. However, I believe there has to be a way to make the connection timeout exception from the JAX-WS not roll back the current transaction especially when the exception was properly handled with a try and catch block.

@GADNT
Copy link

GADNT commented Dec 6, 2017

Hi Adam

In java 9 we have https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/CompletableFuture.html#orTimeout-long-java.util.concurrent.TimeUnit method that permit to us to wait an amount of time and get the result in a non-blocking way beside the https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html#get-long-java.util.concurrent.TimeUnit- method in java 8 that block for result(if I understood it correctly).

If we want the behavior that java 9 method have , what might be the alternative for java8 ?

another subject:
How do you choose the type of the database in your projects? Relational database vs document database

Finally 👍 for you effort during this year and the knowledge's(cool stories) you spread to us.

Thank you
Gabriel

@DKLEEE
Copy link

DKLEEE commented Dec 6, 2017

Hi Adam,

what is your prefered way for connecting a Desktop Application (Eclipse RCP as "thin"client) with a JavaEE Server for back end?
Is Remote EJB still a thing, should we go with REST to maybe switch sometime to Web, WSDL?
Any best practices?

Thanks

@karschdn
Copy link

karschdn commented Dec 6, 2017

Hi Adam,

assuming we have several JEE microservices running in different containers. Could be 4 services or 8, depends on whatever. Each microservice would provide standard information like "current internal status of service running in container" through a REST service.

Now, i want to build an overall status application (may be a single JEE app) which shows the status of all running microservices or provides an "action call" e.g. refresh something in a "known" microservice.

How would you technically implement the "register myself (microservice) to status app" feature in JEE which enables the status app to provide information or action calls of/to each microservice without knowing them by configuration? How do i ensure that only microservices are listed which are online?

regards
Karsten

@newk5
Copy link

newk5 commented Dec 6, 2017

Hello Adam,

I've recently found out about your youtube channel and your blogs, and those have been very helpful, thank you for all the work you've put into it. I have 2 questions I'd like to make

1- In a JSF JavaEE7 application running on payara, is there a way to know through some sort of event/callback/listener when the user's session expires? I'm using JAAS-Based authentication on the payara server using a JDBCRealm. When the user logs in, the session object is stored in a CDI Session-scoped bean.

2- What's your opinion on using vert.x instead of javaee for a microservices based application? Do you think it's a worthy alternative compared to javaee? I'm trying to decide which one to use and the whole ecosystem around JavaEE and its maturity attracts me more than vert.x, however vert.x seems to be more scalable. I've tested scalability using JMeter for a vert.x and a JAX-RS based webapp and saw that vert.x was able to reach double the throughput of javaee and use less resources (I've also tested with @suspended asyncResponse). JAX-RS and JavaEE7 microservices are still a bit new to me so I'm not sure if there's a better way to configure my JAX-RS app to be more scalable and unfortunately I could not find many vertx vs javaee comparisons online.

Thank you and greetings from Portugal!

@Nurudeen
Copy link

Nurudeen commented Dec 6, 2017

Hello Adam ,
I often have below error message when my applications runs , what could possibly be the cause of the error ?

[#|2017-12-06T13:37:26.769+0100|WARNING|oracle-glassfish3.1.2|javax.enterprise.resource.corba.ORBUtil|_ThreadID=602223;_ThreadName=Thread-2;|IOP00410025: Write of message exceeded TCP timeout : max wait time = 6,000 ms, total time spent blocked, waiting to write = 7,280 ms.
org.omg.CORBA.COMM_FAILURE: WARNING: IOP00410025: Write of message exceeded TCP timeout : max wait time = 6,000 ms, total time spent blocked, waiting to write = 7,280 ms. vmcid: OMG minor code: 25 completed: No

Kindly advice for a possible solution .

@deratzmann
Copy link

Hi Adam.
What would you prefer for a Server push implementation: websocket or SSE? Are These Protocols suitable for long living client to server Connections?

Thank you and Best regards from Hamburg.

Bastian

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