Perhaps it’s not a good idea to access session beans from a background thread.
Better store the data required for a background process in the background task instance itself: pass input to the constructor and return results from done() method if needed.
great idea.. this made that error go away.. it super makes my code horrible now because i need to be sending these parameters all over the place… but now.. the operation starts.. stays there a couple of seconds and at the last second it shows the progressbar and hides it. i dont have a list of elements its only a slow web service call i need to do. Just need to notify the end user about it. so its still not really working for me.
Hi Eduardo,
I have a similar situation to what you have.
I am getting the error message below due to the fact that I use SessionData bean to pass data around in my application and there is a need to call restful service from within a background task.
Error creating bean with name ‘core_SessionData’: Scope ‘session’ is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton
Is there a cleaner solution different from what Krivopustov provided?
Right now, I need to email a pdf report from within a background task. The pdf is an output from e report with a dataset connected to an additional datastore that get its data from a restful service.
public void emailRFQ(QuotationRequest quoteReq) throws EmailException {
//set the tenant email smtp details
getMailPropertiesByTenant(quoteReq.getTenant());
String msg = String.format("Request for Quotation %s emailed",quoteReq.getRfqNo());