Skip to content

Java-ee: ProblemClientResponseFilter registered automatically as JAX-RS provider causes exceptions when using Resteasy client in WildFly #251

@Sun8642

Description

@Sun8642

Context

I’m using the belgif-rest-problem-java-ee library with WildFly 26.1.3.Final and Resteasy 4.7.7.Final.
However, it also includes client-side configuration (ProblemClientResponseFilter) annotated with @Provider.

When I try to use a RESTEasy client on WildFly (either from my API using the library or from another application running on the same server), Resteasy automatically registers this ProblemClientResponseFilter as a provider — even though it should only be used for JAX-RS clients.

Problem

When creating a RESTEasy client, RESTEasy tries to instantiate ProblemClientResponseFilter, which throws an exception (on constructor) because it’s not configured through ProblemSupport.enable(client).

This happens without explicitly enabling the Problem support on the client.
As a result, any JAX-RS client created in the application (or another deployed app on the same Wildfly) will fail to initialize correctly.

We want to allow the user to choose if he wants to use the problem support from the library or not. This @Provider forces us to enable the Problem support on the client. It's a real problem if we deploy several application on the same Wildfly, if we try to use other REASTEasy client configured to call other API (which don't use the belgif library), the ProblemClientResponseFilter will still be instantiated and exceptions will be thrown in both deployed war (the server using the library and the app trying to use any configured RESTEasy client)

Expected behavior

The ProblemClientResponseFilter should not be automatically registered as a global JAX-RS provider on the server.

It should only be registered when explicitly enabled via ProblemSupport.enable(client) in client code.

It should not affect other wars deployed on the same Wildfly.

Suggested fix

Remove the @Provider annotation from ProblemClientResponseFilter, and let it be registered only via ProblemSupport.enable(client).

Environment

WildFly: 26.1.3.Final

Resteasy: 4.7.7.Final

Library: belgif-rest-problem-java-ee (latest release as of now)

Java: 17

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions