NullPointerException on all KeyCloak Admin API Calls

If you want to keep Java EE 8 support of WildFly 13, just create empty jackson provider:

public class CustomJacksonProvider extends ResteasyJackson2Provider {

}

and add it to your KeyCloak builder using register() method of ResteasyClientBuilder:

Keycloak kc = KeycloakBuilder.builder()
.realm("master")
.clientId("admin-cli")
.username("admin")
.password("password")
.serverUrl("http://localhost:8880/auth")
.resteasyClient(new ResteasyClientBuilder().connectionPoolSize(10).register(new CustomJacksonProvider()).build())
.build();

You also need to add some resteasy dependecies (as scope=provided) in order to be able to use ResteasyClientBuilder and ResteasyClientBuilder:

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>3.6.2.Final</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson2-provider</artifactId>
        <version>3.6.2.Final</version>
        <scope>provided</scope>
    </dependency>

Put simply (maybe even too much), there was a bug related to the Resteasy libraries, where the JsonBindingProvider was given precedence over the ResteasyJackson2Provider, which made some properties in json payloads not get mapped properly and their values get lost. Hence the NullPointerException.

The simplest solution if you're using JBoss or WildFly should be to exclude the resteasy-json-binding-provider module from your deployment in the jboss-deployment-structure.xml file:

<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.jboss.resteasy.resteasy-json-binding-provider"/>
        </exclusions>
    </deployment>
</jboss-deployment-structure>