Adam Bien's Weblog

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(
	at org.objectweb.asm.ClassReader.accept(
	at org.objectweb.asm.ClassReader.accept(
	at org.glassfish.hk2.classmodel.reflect.Parser$5.on(
	at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(
	at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(
	at org.glassfish.hk2.classmodel.reflect.Parser.doJob(
	at org.glassfish.hk2.classmodel.reflect.Parser.access$300(
	at org.glassfish.hk2.classmodel.reflect.Parser$
	at org.glassfish.hk2.classmodel.reflect.Parser$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$

The following test source was used:

public class BackendService {

    public double average() {
        List<Integer> numbers = new ArrayList<>();
        return -> 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 dates, new workshop: Java EE 7 Workshops: Bootstrap, Effective, Architectures, JavaScript Bootstrap and HTML 5 December, 7th-11th
NEW: Effective Java EE 7 -- Available For Streaming


A book about rethinking Java EE Patterns


Cool. Any idea on how to get support on 4.0? Anything that I can upgrade or patch myself?

Posted by Yannick Majoros on April 18, 2014 at 04:05 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments