0

We have a Quarkus application using RestEasy Reactive, Hibernate Reactive (w/ panache), and Hazelcast for caching. When the application starts up, the endpoints return a response without any exceptions being thrown. However, after around 10 minutes or so, an exception is thrown that we're having a hard time making sense of. The exception is below. The only clues found for when this exception is thrown is the amount of time elapsed (10 mins), and endpoints which make use of the Hazelcast cache.

Resource Method

@GET
@APIResponse(
    responseCode = StatusCode.OK,
    description = "Get All Loans",
    content =
        @Content(
            mediaType = MediaType.APPLICATION_JSON,
            schema = @Schema(type = SchemaType.ARRAY, implementation = Loan.class)))
public Uni<List<Loan>> getLoans(final SearchParameters parameters) {
  return getDomainContextAndThen(
      domainContext -> {
        final LoanSearch search =
            LoanSearch.builder()
                .user(domainContext.getAuthenticatedUser())
                .team(domainContext.getTeam())
                .page(parameters.getPage())
                .perPage(parameters.getPerPage())
                .build();

        return loanService.find(search);
      });
}

Utility Method

protected <T> Uni<T> getDomainContextAndThen(final Function<DomainContext, Uni<T>> callback) {
  // spotless:off
  return Uni.combine()
      .all().unis(getContextTeam(), getAuthenticatedUser()).asTuple()
      .onItem().transformToUni(
          tuple -> callback.apply(new DomainContext(tuple.getItem1(), tuple.getItem2())));
  // spotless:on
}

Service Method

public Uni<List<Loan>> find(final LoanSearch search) {
  if (search.getUser() != null && search.getUser().isBorrower()) {
    return findLoansForBorrower(search);
  }

  return Uni.createFrom().item(new ArrayList<>());
}

private Uni<List<Loan>> findLoansForBorrower(final LoanSearch search) {
  final HQL hql =
      HQL.select()
          .from(LoanEntity.class)
          .join("le.borrowers", "lb")
          .join("lb.borrowerUser", "lbu")
          .joinFetch("le.loTeam", "lt")
          .leftJoinFetch("le.lender", "ll");
  final Condition where = Condition.eq("lbu.email", search.getUser().getEmail());

  if (search.getTeam() != null) {
    where.and(Condition.eq("le.loTeam.id", search.getTeam().getId()));
  }

  hql.where(where);

  return loanRepository
      .find(hql.getQuery(), hql.getParameters())
      .page(search.getPageZeroIndexed(), search.getPerPage())
      .stream()
      .map(loanMapper::toDomain)
      .collect()
      .asList();
}

Exception:

java.util.ServiceConfigurationError: io.smallrye.config.SmallRyeConfigFactory: io.quarkus.runtime.configuration.QuarkusConfigFactory not a subtype
    at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
    at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
    at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getFactoryFor(SmallRyeConfigProviderResolver.java:100)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:76)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:64)
    at org.eclipse.microprofile.config.ConfigProvider.getConfig(ConfigProvider.java:85)
    at io.smallrye.context.impl.DefaultValues.<init>(DefaultValues.java:41)
    at io.smallrye.context.SmallRyeContextManager.<init>(SmallRyeContextManager.java:63)
    at io.smallrye.context.SmallRyeContextManager$Builder.build(SmallRyeContextManager.java:337)
    at io.smallrye.context.SmallRyeContextManagerProvider.getContextManager(SmallRyeContextManagerProvider.java:48)
    at io.smallrye.context.SmallRyeContextManagerProvider.getContextManager(SmallRyeContextManagerProvider.java:37)
    at io.smallrye.context.SmallRyeContextManagerProvider.getManager(SmallRyeContextManagerProvider.java:97)
    at io.smallrye.context.SmallRyeThreadContext.getCurrentThreadContextOrDefaultContexts(SmallRyeThreadContext.java:160)
    at io.smallrye.mutiny.context.DefaultContextPropagationInterceptor.getThreadContext(DefaultContextPropagationInterceptor.java:12)
    at io.smallrye.mutiny.context.BaseContextPropagationInterceptor.decorate(BaseContextPropagationInterceptor.java:24)
    at io.smallrye.mutiny.infrastructure.Infrastructure.decorate(Infrastructure.java:145)
    at io.smallrye.mutiny.groups.UniCreate.item(UniCreate.java:304)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.getSession(AbstractJpaOperations.java:138)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.find(AbstractJpaOperations.java:214)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.find(AbstractJpaOperations.java:209)
    at company.domain.loan.LoanRepository.find(LoanRepository.java)
    at company.domain.loan.LoanRepository_ClientProxy.find(Unknown Source)
    at company.domain.loan.LoanService.findLoansForBorrower(LoanService.java:61)
    at company.domain.loan.LoanService.find(LoanService.java:37)
    at company.domain.loan.LoanService_ClientProxy.find(Unknown Source)
    at company.domain.loan.LoanResource.lambda$getLoans$0(LoanResource.java:76)
    at company.domain.common.resource.SecuredResource.lambda$getDomainContextAndThen$1(SecuredResource.java:41)
    at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:68)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$AndSupervisor.computeAndFireTheOutcome(UniAndCombination.java:152)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$AndSupervisor.check(UniAndCombination.java:131)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$UniHandler.onItem(UniAndCombination.java:221)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23)
    at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:43)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
    at com.hazelcast.client.impl.ClientDelegatingFuture$WhenCompleteAdapter.apply(ClientDelegatingFuture.java:525)
    at com.hazelcast.client.impl.ClientDelegatingFuture$WhenCompleteAdapter.apply(ClientDelegatingFuture.java:507)
    at com.hazelcast.client.impl.spi.impl.ClientInvocationFuture$CallIdTrackingBiFunction.apply(ClientInvocationFuture.java:250)
    at com.hazelcast.spi.impl.AbstractInvocationFuture$HandleNode.lambda$execute$0(AbstractInvocationFuture.java:1536)
    at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Given that QuarkusConfigFactory is a subclass of SmallRyeConfigFactory I was expecting that it wouldn't throw an exception claiming that it is 'not a subtype'. Step debugging through the source code did not reveal anything.

0 Answers0