Skip to content

Unable to create Problem using the ProblemBuilder #357

@tinolazreg

Description

@tinolazreg

Description

We are using this library with Java 9 modules. When attempting to create a Problem using the ProblemBuilder we encounter an exception.
Example:

var outOfStockProblem = Problem.builder()
        .withType(URI.create("https://example.org/out-of-stock"))
        .withTitle("Out of Stock")
        .withStatus(Status.BAD_REQUEST)
        .withDetail("Item B00027Y5QG is no longer available")
        .build();

Throws an exception:

java.util.ServiceConfigurationError: org.zalando.problem.spi.StackTraceProcessor: module org.zalando.problem does not declare `uses`

Expected Behavior

A problem should be created.

Actual Behavior

Exception is thrown.

Possible Fix

Based on the StackTrace, it seems like uses org.zalando.problem.spi.StackTraceProcessor; is missing from org.zalando.problem's module-info.

Steps to Reproduce

Context

Your Environment

  • Version used: 0.27.1
  • Link to your project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions