1 Reply Latest reply on Sep 9, 2014 2:24 PM by icarusdb

    Injecting CDI objects from custom imported jar

    icarusdb

      Hi all

       

      well, I have these web projects administration-client and assets-client

       

      in assets-client I want to use a city combo box I already done in administration-client

       

      I packed city related classes: CityDTO.java, CityConverter.java, CityRepository.java (from where I create annotated combo), CityServiceClient.java (which connects with server side project via RESTful ) and the qualifier ComboBoxActiveCities.java into a administration-client.jar file and I put it inside my web-inf/lib into assets-client proyect

       

      I can declare CityServiceClient into my @ManagedBean AssetsController

      @Injected

      private CityServiceClient cityServiceClient;

       

      but in the eclipse

      I got the "cdi-ambiguous-dependency" warning

       

      and when I deploy into jboss 7.1.1 I got...

      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [CityServiceClient] with qualifiers [@Default] at injection point [[field] @Inject private py.com.icarusdb.assets.client.controller.AssetsController.cityServiceClient]


      I try to add the class into beans.xml using alternatives ( I even try decorators and interceptors just to see what errors may appear ), none worked

       

       

      in the Resources.java file I produced the service:

      @Produces
      public SucursalClientService produceSucursalClientService(InjectionPoint injectionPoint)
      {
          return new SucursalClientService();
      }

       

      and it worked some how, but I don't want to do it for every CDI or @Named objects I have

       

      so, I have no idea what next