对不起我的英语......可能有人帮我找到有关在 glassfish 服务器中使用基于角色的安全性的批处理作业的信息?当我从 EJB 调用该方法时:
@Override
@RolesAllowed({"root_role", "admin_role", "user_role"})
public void execute() {
BatchRuntime.getJobOperator().start(STATISTIC_JOB_NAME, new Properties());
}
我得到这样的异常: javax.ejb.AccessLocalException: Client not authorized for this invocation
我的工作类别:
@Dependent
@Named(value = "StatisticJob")
public class StatisticJob extends AbstractBatchlet {
@EJB
private StatisticFacadeLocal sfl;
@Override
public String process() throws Exception {
System.out.println("StatisticJob.process()");
List<StatisticPortEntity> spes = sfl.findAll();
if (spes != null && !spes.isEmpty()) {
for (StatisticPortEntity spe : spes) {
System.out.println(spe);
}
} else {
return "Statistic list is empty.";
}
return "StatisticJob.proccess is done.";
}
}
如何在批处理中使用基于角色的安全性?谢谢!