Does exist a method for inject an
ejb into a Runnable? First time i've tried to make my Runnable class "@Stateless" and then inject through "@EJB", then i've tried with the context lookup
public class Pusher implements Runnable{
public Pusher(){
}
@Override
public void run() {
InitialContext ctx;
try {
ctx = new InitialContext();
VehicleStatusLocal vehicleS = (VehicleStatusLocal) ctx.lookup("statusBean");
//launch ejb method
vehicleS.update();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i know that the right way is to inject a bean inside the EJB context. But i have to update some data from a non-EJB class.
Thanks