3 Replies Latest reply on Jan 3, 2017 9:45 AM by Martin Kouba

    Unpredictable UnsatisfiedResolutionException: WELD-001308 Unable to resolve any beans for Types

    Alexander Straube Newbie

      Hi,

       

      sometimes we get following error but it's really unpredictable. Sometimes it happens no, once or multiple times a day without any specific reason

      org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308 Unable to resolve any beans for Types: [class de.acme.service.AcmeService]; Bindings: [QualifierInstance{annotationClass=interface javax.enterprise.inject.Default, values={}, hashCode=-83976784}]
          at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:717) [weld-core-1.1.28.Final-redhat-1.jar:1.1.28.Final-redhat-1]
          at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:102) [weld-core-1.1.28.Final-redhat-1.jar:1.1.28.Final-redhat-1]
          at de.acme.service.AcmeRestService.getAcmeStuff(AcmeRestService.java:52) [classes:]
          at de.acme.service.AcmeRestService$Proxy$$$_WeldSubclass.getAcmeStuff(AcmeRestService$Proxy$$$_WeldSubclass.java) [classes:]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_80]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_80]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_80]
          at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_80]
          at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:85) [weld-core-1.1.28.Final-redhat-1.jar:1.1.28.Final-redhat-1]
      

       

      Code looks like

      package de.acme.service;
      
      import javax.inject.Inject;
      import javax.inject.Provider;
      import javax.ws.rs.GET;
      import javax.ws.rs.Path;
      import javax.ws.rs.PathParam;
      import javax.ws.rs.Produces;
      import javax.ws.rs.core.Response;
      
      @Path("/acme")
      public class AcmeRestService extends AbstractRestService {
      
          @Inject
          private Provider<AcmeService> acmeService;
      
          @GET
          @Path("/{id}/stuff")
          
          public Response getAcmeStuff(@PathParam("id") Long id) {
              return buildResponse(acmeService.get().getAcmeStuff(id));
          }
      }
      

       

      package de.acme.service;
      
      import javax.ejb.Stateless;
      import javax.inject.Inject;
      import java.util.List;
      
      @Stateless
      public class AcmeService implements RapRestClientService {
      
          @Inject
          private Client<AcmeRestClientInterface> client;
      
          public List<AcmeDTO> getAcmeStuff(Long id) {
              return client.get().doSomething(id);
          }
      
      }
      
      

       

      Kind regards,

      Alexander