Bug Report: MP Rest Client is not deployed on Payara startup only/FISH-12192
Brief Summary
When injecting a MicroProfile @RestClient interface into a CDI bean, injection fails, but only when restarting the server.
Latest server is being used (7.2025.2)
This also happens when PostBoot file is being used to deploy the application.
The issue is in the first file at the injection point.
MyApplication.java
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@ApplicationScoped
public class MyApplication {
@Inject
@RestClient
RestApiClient client;
}
RestApiClient.java
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@Path("/api")
@RegisterRestClient
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface RestApiClient {
@GET
@Path("/greet")
String greet();
}
I believe it relates to an old bug #4704
Expected Outcome
Domain starts and restarts successfully
Current Outcome
Initial deployment is OK. However, when domain is stopped and started, (or re-started) using asadmin start-domain or asadmin restart-domain, you see the following exception and the app fails to deploy:
[#|2025-09-24T22:33:41.918-0500|SEVERE|Payara 6.2025.9|javax.enterprise.system.core|_ThreadID=58;_ThreadName=RunLevelControllerThread-1758771218774;_TimeMillis=1758771221918;_LevelValue=1000;_MessageID=NCLS-CORE-00026;|
Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408: Unsatisfied dependencies for type RestApiClient with qualifiers @RestClient
at injection point [BackedAnnotatedField] @Inject @RestClient com.flowlogix.reproducers.payara.MyApplication.client
at com.flowlogix.reproducers.payara.MyApplication.client(MyApplication.java:0)
-- WELD-001408: Unsatisfied dependencies for type RestApiClient with qualifiers @RestClient
at injection point [BackedAnnotatedField] @Inject @RestClient com.flowlogix.reproducers.payara.MyApplication.client
at com.flowlogix.reproducers.payara.MyApplication.client(MyApplication.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:379)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:294)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:141)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:533)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:518)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:493)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:497)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:94)
at org.glassfish.weld.WeldDeployer.startWeldBootstrap(WeldDeployer.java:568)
at org.glassfish.weld.WeldDeployer.processApplicationLoaded(WeldDeployer.java:501)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:399)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:135)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:344)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:571)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:434)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:266)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:303)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:351)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:466)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2103)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:762)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.base/java.lang.Thread.run(Thread.java:1474)
|#]
Reproducer
- Clone the reproducer: https://github.com/flowlogix/mp-rest-client-deploy-fail
./mvnw package- Deploy the WAR
- stop the domain
- restart the domain
You will see the error when restarting Or, you can deploy the attached WAR.
mp-rest-client-deploy-fail-1.x-SNAPSHOT.war.zip
Operating System
Any
JDK Version
Zulu 25
Payara Distribution
Payara Server Full Profile
Hello @lprimak,
Thank you very much for reporting this issue! I have managed to reproduce it, in my case it only worked using the stop-domain followed by a start-domain, using restart-domain command surprisingly allows the reproducer to deploy just fine on my end. I have raised this issue to the Platform Development team using codename FISH-12192, and they will fix the issue as soon as they have bandwidth available.
Best regards, Felix Ifrim
using restart-domain command surprisingly allows the reproducer to deploy
Yes, there may be a timing issue with restart-domain, as I can only reproduce that bit half the time as well.
Same issue is happening when deploying apps via PostBoot.
~~The issue seems to be parallel HK2 class model initialization. Looks like it's not completing by the time PostBoot or redeployment is performed.~~
Hello @lprimak,
I have added the information to the internal issue and also linked it to #7806 and its associated PR. Thank you again for your research and constant contributions!
Update: This doesn't look like a race condition, but some kind of interaction between OSGi and HK2 as it can't find the Rest Client package during startup.
I have traced this into OSGi and the Eclipse Rest Client bundle is in Installed state but not Running state which is causing this issue. I have now gotten the app to deploy in the debugger by forcing to run the Rest bundle manually.
I will investigate further.