Adam Bien's Weblog

Setting Timeout For JAX-RS / TomEE CXF Client

The name of the "read" and "connection" timeout properties is not standardized in Java EE 7. For TomEE / CXF clients you will have to use the "CXF-proprietary" names:


import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

Client client = ClientBuilder.newClient();
client.property("http.connection.timeout", 500L);
client.property("http.receive.timeout", 500L);

The name differs in Jersey (used in GlassFish / Payara), but the semantics are the same.

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

Java EE (and Docker) Quickstart

  1. Create a Thin WAR Java EE project. Name it "micro".
  2. Create a Dockerfile in project folder with the following content:
                
                FROM airhacks/wildfly
                COPY ./target/micro.war ${DEPLOYMENT_DIR}                
                
            

    Also airhacks/payara, airhacks/tomee images are available from https://hub.docker.com/u/airhacks/. The docker files are maintained in https://github.com/AdamBien/docklands.

  3. Perform build from project folder: mvn package && docker build -t airhacks/micro .
  4. Run the project: docker run -d -p 8080:8080 --name micro airhacks/micro

See it in action: https://www.youtube.com/watch?v=P6Bk3Eiz3kE.

Behind the scenes:

  1. CentOS 7, JDK 1.8, the choosen application server (WildFly, Payara, TomEE) is going to be downloaded the first time (~560 MB, see https://youtu.be/hoqJdH87e7g) from https://hub.docker.com/u/airhacks/.
  2. All subsequent builds will only rebuild the Thin WAR -- it will take milliseconds. The smaller the WAR, the higher the productivity: https://youtu.be/5N4EUDhrkec
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

Gartner and Java EE, BCE, Modular JSF, Monitoring, JAX-RS Refactoring or 39th airhacks.tv

55 mins, 125 live attendees, ~20 topics ranging from Gartner and Java EE, BCE architecture, modular JSF, monitoring, REST refactoring, how to learn Java EE (see all topics), or the 38th airhacks.tv episode is available:

Any questions left? A fresh question queue is setup. Ask now: https://gist.github.com/AdamBien/b1a66dafdae21c0c40d647f05f44e57c and see you at June, 5th, 2017, 6 pm CET.

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 (and Microservice) Quickstart

  1. Create Thin WAR project with: mvn archetype:generate -Dfilter=com.airhacks:javaee7-essentials-archetype. (see: Setting Up Java EE 7 Projects With Maven 3)

    Result: 24 lines of pom.xml. The pom.xml only conatins a single dependency to Java EE 7 API. In real world projects you will only need to add test dependencies like JUnit or Mockito. The file beans.xml (one tag), was created to enable Depenency Injection (DI) everywhere and the annotated class JAXRSConfiguration activates JAX-RS under the resources uri. The generated Thin WAR project is a production ready template for Java EE / Microservices / Thin WARs.
  2. Create a JAX-RS resource, like .e.g.
            
        import javax.ws.rs.GET;
        import javax.ws.rs.Path;
        
        @Path("message")
        public class HelloResource {
    
            @GET
            public String message() {
                return "works!";
            }       
        }
    
    
  3. Perform mvn package and copy the Thin WAR ./target/[NAME].war (~4 kB) into the autodeploy / deploy folder of Java EE 6 / 7 / 8 application server of your choice.
  4. ...or download NetBeans "Java EE Edition", open the project, and click "run".
  5. Open the browser with: http://localhost:8080/[NAME]/resources/message

Use a full profile Java EE application servers (Payara, WildFly, TomEE, WebLogic, Websphere Liberty Profile). The download size varies between 55 MB and 200 MB. The runtime overhead is around 50 MB RAM (see live memory profiling: "The (RAM) Overhead Of Java EE Application Servers").

For mainstream (microservices) projects there is no further tuning, configuration or optimization required.

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

Gartner, BCE, Modular JSF, Firehose, Translations, Favorite Application Server, GET Refactoring or Questions for 38th airhacks.tv

Questions (gist) for the 38th airhacks.tv, May, 8th, 7pm (exceptionally one hour later):

  1. Java EE 8 and Oracle Code Conference News
  2. Gartner and obsolete Java EE
  3. BCE and loggers, custom validators and "helpers"
  4. Wider topic: what are helper classes?
  5. Modular JSF?
  6. Firehose: performance and scalability considerations
  7. Storing / caching translations
  8. Refactoring GET endpoints with query params
  9. Dealing with Jackson "Unknown Properties"
  10. My favorite application servers
  11. Cross cutting libs (e.g. JCache) and docker
  12. CDI Events and generic types
  13. IBM, RedHat and Project Jigsaw
  14. How to approach effectively Java EE
  15. Application servers, connection pools and clustering

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

GlassFish v5 (Java EE 8 RI)--Docker Image Is Available

GlassFish v5 ea (Java EE 8) builds available for download: http://download.oracle.com/glassfish/5.0/index.html

The nightly build is also available from docklands as glassfish5 and glassfish5-ping Dockerfiles.

Binary images are directly available from the public docker registry: https://hub.docker.com/u/airhacks/.

To start glassfishv5 perform docker run -d -p 8080:8080 --name glassfishv5 airhacks/glassfish-ping

The ping should be availabe after ~3 secs under: http://localhost:8080/ping.

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

Serverless Microservices On Java EE Servers -- Oracle Code Keynote In London

The "Live For The Code" Keynote in London, 20th April 2018 is available:

The sample code from the slideless keynote was pushed to: https://github.com/AdamBien/live4code -- expect commits during upcoming keynotes.

See you in Berlin. I decided to continue with the implementation of the serverless microservice :-).

I also participated in "Ask Me Anything" Q&A reddit session after the keynote. The conversation is available at: https://www.reddit.com/r/IAmA/comments/66k9rv/hey_redditors_its_adam_bien_author_of_real_world/

Interested in more details? Then 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

Accessing The Current Build User In Jenkinsfile Pipeline

To access the current user in the Jenkinsfile install the Build User Vars Plugin first. After the installation the current user becomes available within the wrap block:


 wrap([$class: 'BuildUser']) {
    echo "userId=${BUILD_USER_ID},fullName=${BUILD_USER},email=${BUILD_USER_EMAIL}"
}

See you at Java EE Workshops at MUC Airport, particularly at the Java EE Testing, Pipelines as Code, CI / CD, Testing and Quality workshop


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, Microservices and HTML 5 -- Bucharest Voxxed Days Keynote

During the Bucharest Voxxed Days Keynote I discussed the impact of using "standards" from Java EE backend to the HTML 5 frontend:

Any questions left? See you at airhacks.tv.

Interested in Thin WARs and WebStandards? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Building HTML 5 Applications With WebStandards 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

(Free) Oracle Code Conference and Enterprise Java.next: A Slideless Keynote

I will deliver keynotes for (free) Oracle Code conferences in London, Berlin, Prague and Brussels. The deal was: slideless content. The advantage is: the content (=code) will vary across cities and is going to be influenced by the attendees.

See you soon at 9am:

  1. April, 20th, London
  2. April, 24th, Berlin
  3. April, 28th, Prague
  4. June, 6th, Brussels

Prepare your questions!

Also 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

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