ServiceLocator can't find an implementation in common-pool workers
See original GitHub issueHi, I’ve noticed that we can’t read/create a token in a worker from ForkJoinPool.commonPool()
in Spring’s uber-jar application because ServiceLocator can’t find an implementation for that (looks like there is a problem with context class loader related to the thread).
Example (it will throw UnavailableImplementationException
for Serializer.class
):
ForkJoinPool.commonPool()
.execute(() -> Jwts.builder()
.setClaims(Map.of(Claims.SUBJECT, "subject"))
.compact());
Currently, I have a workaround to that by providing my own serializer (like this https://github.com/jwtk/jjwt#jackson-json-processor).
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
java - ServiceLoader to find implementations of an interface
There are no built-in ways find all classes that implement a particular interface. Frameworks that can do something similar use their own classpath...
Read more >Service Locator Pattern and Java Implementation - Baeldung
In this tutorial, we're going to learn about the Service Locator design pattern in Java. We'll describe the concept, implement an example ......
Read more >Jersey 2.37 User Guide - GitHub Pages
This is user guide for Jersey 2.37. We are trying to keep it up to date as we add new features. When reading...
Read more >Transforming U.S. Workforce Policies for the 21st Century
The publication of Transforming U.S. Workforce Development Policies for the 21st Century is the culmination of nearly two years of ...
Read more >ForkJoinPool (Java Platform SE 8 ) - Oracle Help Center
A ForkJoinPool differs from other kinds of ExecutorService mainly by virtue of employing work-stealing: all threads in the pool attempt to find and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also want to say thank you to @timsazon for the sample project! That’s so helpful!
@lhazlewood, I didn’t use a classloader, but I did mimic the “accessor” model that
Classes
uses. Let’s move the implementation discussion over to #574(I just tested this out on @timsazon’s sample project)