we have mixed the usage of CDI and EJB in our application. At startup, we receive the error Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped
.
We don't understand where exactly the problem is, so here is just the overall structure of the code:
@Stateless
public class SomeFacade {
@Inject
private SomeService someService;
}
@Stateless
public class SomeService {
@Inject
private SomeDao someDao;
}
@Stateless
public class SomeDao {
@Inject
private EntityManager entityManager;
}
@ApplicationScoped
public class EntityManagerProducer {
@Produces
@ApplicationScoped
public EntityManagerFactory createEntityManagerFactory() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("one");
return emf;
}
public void close(@Disposes EntityManagerFactory entityManagerFactory) {
entityManagerFactory.close();
}
@Produces
public EntityManager createEntityManager(EntityManagerFactory entityManagerFactory) {
return entityManagerFactory.createEntityManager();
}
}
Is there something we can change in general?