0 Replies Latest reply on Feb 2, 2019 5:03 AM by andrej.petras

    Wildfly 15.0.1 Final: Microprofile rest client - redeployment WELD-001414: Bean name is ambiguous.

    andrej.petras

      Hi,

       

      I am trying the microprofile rest client on the Wildfly 15.0.1.Final. I did not find the documentation or how to. Is there any documentation for wildfly?

       

      These are my steps and errors:

       

      I need to add the dependency to the module org.eclipse.microprofile.restclient to my manifest. Without this I get class org.eclipse.microprofile.rest.client.RestClientBuilder not found.

      I think this is not correct because this module is private module of the Wildfly.

       

      <manifestEntries>
          <Dependencies>org.eclipse.microprofile.restclient</Dependencies>
      </manifestEntries>
      

      After this I was able to deploy the application and use the rest client via RestClientBuilder or @RestClient CDI integration.

       

      But when I redeploy the running application on the server I get this error:

       

      09:35:25,936 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."mp-client-1.0.0-SNAPSHOT.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."mp-client-1.0.0-SNAPSHOT.war".WeldStartService: Failed to start service
              at org.jboss.msc@1.4.5.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1730)
              at org.jboss.msc@1.4.5.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1558)
              at org.jboss.threads@2.3.2.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
              at org.jboss.threads@2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
              at org.jboss.threads@2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
              at org.jboss.threads@2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
              at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414: Bean name is ambiguous. Name org.lorislab.mp.client.api.TestRestService resolves to beans: [org.jboss.resteasy.cdi.microprofile.RestClientDelegateBean@2a357dc2, org.jboss.resteasy.cdi.microprofile.RestClientDelegateBean@59b2b6ec]
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bootstrap.Validator.validateBeanName(Validator.java:653)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bootstrap.ConcurrentValidator$5.doWork(ConcurrentValidator.java:121)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bootstrap.ConcurrentValidator$5.doWork(ConcurrentValidator.java:119)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
              at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
              at java.base/java.lang.Thread.run(Thread.java:834)
              at org.jboss.threads@2.3.2.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
      09:35:25,941 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"mp-client-1.0.0-SNAPSHOT.war\".WeldStartService" => "Failed to start service
          Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414: Bean name is ambiguous. Name org.lorislab.mp.client.api.TestRestService resolves to beans: [org.jboss.resteasy.cdi.microprofile.RestClientDelegateBean@2a357dc2, org.jboss.resteasy.cdi.microprofile.RestClientDelegateBean@59b2b6ec]"}}

       

      Did I am miss something in the configuration of the Server, CDI or Microprofile rest client?

       

      Thanks!

      Andrej

       

      I created simple example application to reproduce this error.

       

      How to reproduce this error on the Widlfly 15:

      1. start the server

      2. mvn clean install

      3. copy the mp-client-1.0.0-SNAPSHOT.war in the deployments directory.

      4. run rest client

           4.1 With CDI: curl http://localhost:8080/mp-client/test/1

           4.2 Without CDI: curl http://localhost:8080/mp-client/test/2

      5. rebuild and redeploy the application on running server (see step 2 and 3)

       

      Attachments:

      • mp-client.zip - source code
      • mp-client-1.0.0-SNAPSHOT.war - example application