Skip to content

JAXB Implementation not found in Java 11 when using Failsafe with Retries & Spring Boot #953

@tobias-bahls

Description

@tobias-bahls

When using riptide-soap together with retries from riptide-failsafe in Java 11 on a packaged Spring Boot jar, the call fails with javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath. despite the correct JARs being in the classpath.

Description

In this specific combination:

  • riptide-soap
  • riptide-failsafe with retries enabled
  • Java 11
  • Packaged spring boot jar

The call to create a JAXBContext with the aforementioned message. If retries are disabled, everything works as expected.

The root cause of the issue seems like that Failsafe is using ForkJoinPool.commonPool() internally, resulting us in hitting spring-projects/spring-boot#15737.

Possible Fix

I can think of two options:

  • Explicitly passing the current class' class loader to JAXBContext.newInstance(). This requires us to switch to creating JAXBContext with contextPath instead of the class to be bound.
  • Explicitly supplying an Executor to Failsafe that creates threads with the proper context class loader.

I don't know which of these options is better, but I'd be happy to implement the change if there is some consensus.

Steps to Reproduce

I can provide a sample project if needed

Your Environment

  • Version used: 3.0.0-RC.14

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions