12 Replies Latest reply on Oct 10, 2010 11:50 AM by Wujek Srujek

    Getting "Injection point has ambiguous dependencies", but there is only one producer

    Anders Åberg Newbie

      Hi guys
      I am experimenting with a @Producer method in order to allow injection of a POJO:

      public class UserDataProducer implements Serializable {
          private UserData userData;
          public UserData getUserData() {
              if (userData == null) {
                  userData = new UserData();
              return userData;

      The UserData class is a plain Java object, not @Named, @ManagedBean or anything:

      public class UserData implements Serializable {
          private String uid;
          private String culture;

      However, when trying to inject this I get this exception:

      Injection point has ambiguous dependencies. 
      Injection point: field no.evote.presentation.MessageCatalogImporter.userData; 
      Qualifiers: [@javax.enterprise.inject.Default()]; 
      Possible dependencies: [
      org.jboss.weld.bean-/C:/Dev/glassfish-3.0.0-eclipse/glassfish/domains/domain1/eclipseApps/admin-web/-ManagedBean-class no.evote.security.UserData, 

      What I don't understand is why Weld reports UserData as a -ManagedBean-. As far as I can tell there is only one valid producer here, UserDataProducer.getUserData().

      Am I missing something here? Is there any way I can mark UserData as unmanaged?

      BTW, the reason UserData is a POJO and not a managed bean is that it causes some strange errors when passed as parameter to remote EJB's. Maybe not that strange really since there is no session on the server.

      Regards, Anders