facesProduces file error

0

is giving error

  

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001409:   Ambiguous dependencies for type HttpServletRequest with qualifiers   @Default at injection point [BackedAnnotatedField] @Inject private   com.oliveira.pedidovenda.controller.LoginBean.request at   com.oliveira.pedidovenda.controller.LoginBean.request (LoginBean.java:0)   Possible dependencies:     - WELD% AbstractBuiltInBean% C: \ Users \ Adriano \ Documents \ NetBeansProjects \ Sales Order \ target \ Sales Order-1.0-SNAPSHOT \ WEB-INF \ classes% HttpServletRequest,     - Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces   @RequestScoped public   com.oliveira.pedidovenda.util.jsf.FacesProducer.getHttpServletRequest ()]

    
asked by anonymous 12.08.2016 / 04:19

1 answer

0

Just read your erroneous log a bit to see the problem: "Ambiguous dependencies for type HttpServletRequest with qualifiers". Not an expert in jsf, but I know this error occurs when you are injecting dependency but the CDI can not find the specific object or class you intend to inject. You can solve this with Java Qualifiers, it works as annotation. I will exemplify with my DAO producer. Qualifier

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE,ElementType.PARAMETER,ElementType.FIELD})
public @interface DAOPadrao {

}

Make necessary imports now in the production class:

@ApplicationScoped
public class DAOProducer implements Serializable {

@Produces
@RequestScoped
@DAOPadrao
public SuperDAO superDAO() {
    return new SuperDAO();
}
}

Basically it is only you to create your qualifying annotation and write down the producer method with it.

    
28.08.2016 / 18:00