Payara, "java.lang.NoSuchMethodError:" Problem and Solution

Payara Server loads own libraries / jars like e.g. Google's Guava first. In case your application uses a recent feature (e.g. a method) in a newer version of such a library, you will get an exception like:

Caused by: java.lang.NoSuchMethodError:$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator;

Turning off the class loader delegation solves the problem:

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE payara-web-app PUBLIC "-// Payara Server 4 Servlet 3.0//EN" "">
    <payara-web-app error-url="">
    <class-loader delegate="false"/>

However, a code refactoring and the removal of the dependency from the pom.xml and using Java 8+ / Java EE features only will make your WARs thinner and docker deployments faster:

See you at Web, MicroProfile and Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home:

Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition the podcast:

Stay in touch:


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