java ee - losing conection to EJB after restart -
i have app connecting ejb retrieve data. ejb in separate ear. app using delegate-singleton pattern connection ejb. problem is, ejb gets redeployed quite because it's still being developed , every time happens app ends disconnecting , unable reconnect when ejb comes online because singleton's getinstance method keeps returning empty remote object reference , connection cannot reestablished, have redeploy client app able reconnect. way keep happening, doesn't involve doing lookups on every request?
public class delegate { ... private datastoreservice getdatastoreserviceinterface { servicelocator servicelocator = servicelocator.getinstance(); return servicelocator.getdatastoreservice(); } public data getdata(){ datastoreservice datastoreservice = getdatastoreserviceinterface(); return datastoreservice.getdata(); } } public class servicelocator{ private static servicelocator instance = null; private datastoreservice datastoreservice = null; protected context context; private servicelocator(){ context = new initialcontext(); datastoreservice = (datastoreservice)context.lookup(datastoreservice.class.getname()); } static public servicelocator getinstance(){ if (instance == null) { instance = new servicelocator(); } return instance; } }
apparently container bug in weblogic 10.3.6, had remove singleton logic avoid issue
Comments
Post a Comment