Sorry for my english.... May be someone help me find information about using batch job with role-based security in glassfish server? When I invoke the method from EJB :
@Override
@RolesAllowed({"root_role", "admin_role", "user_role"})
public void execute() {
BatchRuntime.getJobOperator().start(STATISTIC_JOB_NAME, new Properties());
}
I get exception like this: javax.ejb.AccessLocalException: Client not authorized for this invocation
My job class:
@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.";
}
}
How use role-based security with batch? Thank's!