Adam Bien's Weblog

Wednesday Apr 23, 2014

javaee7-essentials-archetype v1.2 released

The version 1.2 of the javaee7-essentials-archetype was released.

Features:

  1. Java 8 is the default compiler source and target
  2. The name of the war is derived from the artifactId. The version is no more appended.

Create a project directly from the IDE (in NetBeans: New Project -> Maven -> Project From Archetype. Choose com.airhacks as groupId in the search box).

Or use the CLI:


mvn archetype:generate -Dfilter=com.airhacks:javaee7-essentials-archetype

The archetype's source is available at: https://github.com/AdamBien/javaee7-essentials-archetype. The project can be also directly cloned from: https://github.com/AdamBien/javaee-essentials-pom

Enjoy the lean way of coding! :-)

See you at Java EE Workshops at MUC Airport!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Friday Apr 18, 2014

Java 8, Method Handles and Concurrency Utilities For Java EE

Java 8 with method handles enables direct execution of synchronous (legacy) code asynchronously within a managed thread pool:

Prepare your questions—I will attempt to answer them…live. See you soon!

See also other screencasts at: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.

See you at Java EE Workshops at MUC Airport!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Tuesday Apr 15, 2014

Java 8: Reducing a List Into A CSV String


import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import org.junit.Test;

public class CSVStreamTest {

    @Test
    public void listToString() {
        List<String> mascots = new ArrayList<>();
        mascots.add("duke");
        mascots.add("juggy");

        String expected = "duke,juggy";
        String actual = mascots.stream().
                reduce((t, u) -> t + "," + u).
                get();
        assertThat(actual, is(expected));
    }
}

See you at Java EE Workshops at MUC Airport!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Monday Apr 14, 2014

How To Tackle JavaEE - DevCrowd Keynote

How to structure a JavaEE application? How to organize your code? What are the essential ingredients of a maintainable JavaEE application? How to be productive with JavaEE?

I discussed such questions during the DevCrowd keynote: http://2014.devcrowd.pl/agenda/.

Warning: I used slides in the first part of the keynote :-).

Any questions left? Prepare your questions and I will attempt to answer them …live. Drop a comment / question && see you at each first Monday of the month at 6 p.m (CET) [http://www.ustream.tv/channel/adambien]!

See you at Java EE Workshops at MUC Airport, particularly at the Java EE Architectures workshop, screencasts at: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Tuesday Apr 08, 2014

1st Airhacks Q&A And The Answers Are:

Additional 10 live questions, 1h and 83 live views. The first edition Airhacks Q & A was fun for me. I started with answering the 10 proposed questions, then got additional blog comments, tweets and chats in real time. After a 1h I had to catch QuestionsOverflowException and postponed some answers to the 2nd edition of Airhacks Q & A (Monday, May 5th, 6 PM (CET)): http://www.ustream.tv/channel/adambien.

Thanks for all the interactions during the event. It was fun for me ...and I saved lots of time.

Write your questions as comments to this post, drop me a tweet or write a comment on my youtube channel: https://www.youtube.com/user/bienadam. I will pick again the 10 most recent questions and will answer them at the next edition of Airhacks Q & A.

We have sufficient stuff to cover, this blog has about 5000 comments, and probably 20% of that number are unanswered questions.

See you at the regular Java EE Workshops at MUC Airport and particularly at Distributed Computing and Persistence with Enterprise Java. ...and live each first Monday of the month at 6 P.M (CET) http://www.ustream.tv/channel/adambien!

See also other screencasts at: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Monday Apr 07, 2014

1st Airhacks Q&A And The Questions Are:

  1. Jeff Picklyk: "How would you suggest convincing the ivory tower decision makers to leave plain old Tomcat + Spring in favour of JavaEE 6 or 7?"
  2. Andreas Haufler: "...and you should evaluate: Do I even need a JavaEE monster? Scalability can be achieved at a much lower price (in terms of learning curve and complexity)."
  3. My thoughts on Controversial 80 characters max withs.
  4. Tony Anecito: "JavaFX and ClassPath"
  5. Alberto Gori: "If this is true, I would say it's better to call em.clear() just after em.flush()."?
  6. Manfred Pauli: "You state you're never design your application by technical structures. Where would you pack exceptions to? Especially if they are used through the whole project. "
  7. Yasser: "I am trying to use your example, but my test fails at "facade.service = service". It looks like my test case doesn't have access to the @EJB Service in the ServiceFacade."
  8. Tim B. "If you have two applications communicate via REST and DTOs are forbidden, how do you share the model between those two?"
  9. Anonymous: "How one generates eg: REST client stubs in Delphi for java endpoints? There is still no widespread WSDL-like tools for REST"
  10. Conversation with Jeanne Boyarsky about @Ignore in unit test

I will at least answer the above questions today. If you have any other questions, just write a comment to this post. There are a few hours left...

You can also ask questions during the show using the built-in chat: or via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks.

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Thursday Apr 03, 2014

GlassFish v4.0.1 Daily Build Supports Java 8 Lambda

GlassFish v4.0 does not support lambdas. If you attempt to deploy a Java EE 7 application with CDI and Lambdas you are going to get the following exception:


Severe:   Exception while visiting WEB-INF/classes/com/airhacks/lambda/test/BackendService.class of size 1825
java.lang.ArrayIndexOutOfBoundsException: 52264
	at org.objectweb.asm.ClassReader.readClass(ClassReader.java:2015)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:469)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
	at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:362)
	at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:165)
	at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:127)
	at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:347)
	at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:67)
	at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:306)
	at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:295)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:744)

The following test source was used:


@RequestScoped
public class BackendService {

    public double average() {
        List<Integer> numbers = new ArrayList<>();
        numbers.add(42);
        numbers.add(21);
        numbers.add(7);
        return numbers.stream().mapToInt(i -> i).average().getAsDouble();

    }
}

However, GlassFish v4.0.1 nightly builds builds starting with March, 20th 2014 supports Java 8 and lambdas. You can deploy Java EE 7 applications running on Java 8 with lambdas.

See you at Java EE Workshops at MUC Airport!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Wednesday Apr 02, 2014

Airhacks Q & A and How To Tackle Java EE (7)

Two free (no registration required) streaming, but interactive, events are waiting for you:

  1. Airhacks Questions and Answers: At the first Monday of each month at 6 P.M. CET. (next event is scheduled for: Monday, April, 7th, 6 P.M CET). I'm going to answer all remaining questions about Java (SE/EE/FX/Nashorn) from http://workshops.adam-bien.com, this blog, https://twitter.com/AdamBien and from "the streets" :-). The length of the event directly depends on the question's queue depth.
  2. Virtual Keynote: "How To Tackle Java EE 7" from http://2014.devcrowd.pl/. Abstract:
    You don't have to know the complete Java EE 7 API to create maintainable enterprise applications efficiently. The reverse is true: well designed Java EE applications comprise 95% business logic and only 5% plumbing. In this talk I would like to introduce a business driven approach to maintainable Java EE with lots of code and some slides
You can attend both events without any registration at: http://www.ustream.tv/channel/adambien. Questions can be asked during the event using the built-in chat or twitter with hashtag #airhacks.

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Thursday Mar 27, 2014

Java 8 + Nashorn Scripting + Mustache = Static Page Generator

SPG is a Static Page Generator written in JavaScript as an executable script on top of Java 8. SPG comprises a single file, comes with a single JavaScript dependency (mustache.js) and only requires Java 8 installed on your system.

SPG is simple: input.json + input.htm (processed by https://github.com/janl/mustache.js template) => input.htm (result).

SPG relies on mustache.js for rendering and therefore comes with support for sections, functions, conditional rendering etc.

SPG was created to maintain the registration pages for http://workshops.adam-bien.com (externalize the dates, show badges like "registration closed"), so it is heavily used in production :-).

You will find sources at github. SPG is open source and Apache 2 licensed.

See you at Java EE Workshops at MUC Airport. SPG is going to be discussed during the Java EE 7 + HTML 5 workshop.


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Tuesday Mar 25, 2014

CORS For JAX-RS 2.0 / Java EE 7 Released

Cross-origin resource sharing support for Java EE 7 / JAX-RS 2.0 is released.

The following dependency in a WAR will install and setup the CORS extension automatically:


<dependency>
	<groupId>com.airhacks</groupId>
	<artifactId>jaxrs-cors</artifactId>
	<version>0.0.1</version>
	<scope>compile</scope>
</dependency>

CORS is opensource and Apache licensed: https://github.com/AdamBien/cors

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License