2
は私がスレッドを実行しようとすると、このエラーがあります:実行プロセス(JSF 2.2 - WELD 2.3)
WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped
をだから私はこのエラーがあります:
2017-09-08 14:09:56,205 ERROR [br.com.ideallsistemas.obrigacoes.util.jsf.JsfExceptionHandler] Erro: #{emailCadastroBean.enviarEmail()}: java.lang.NoClassDefFoundError: org/jboss/weld/environment/se/Weldjavax.faces.FacesException: #{emailCadastroBean.enviarEmail()}: java.lang.NoClassDefFoundError: org/jboss/weld/environment/se/Weld
豆から呼び出された私の方法
public void enviarEmail(Email email) {
List<String> destinatarios = destinatariosOf(email);
Weld weld = new Weld();
final WeldContainer container = weld.initialize();
RequestContext requestContext= container.instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get();
requestContext.activate();
final EnvioEmailService pojo = container.instance().select(EnvioEmailService.class).get();
Thread envioiEmail = new Thread() {
public void run() {
try {
for (String destinatario : destinatarios) {
pojo.envioEmailTaskDo(email, destinatario);
}
}catch (Exception e) {
System.out.println(e.getMessage());
}
}
};
envioiEmail.start();
weld.shutdown();
}