I don't understand what you are proposing here.  I also think that tomcat's new 
thread also removes the jndi and transaction context handling from 
initialization so it is a lot more broken that we have seen yet.

For this code in particular WebBeansContext.getInstance() is the call that 
fails right now because the GeronimoSingletonService has not been initialized 
with the correct WebBeansContext for this thread.  The correct WebBeansContext 
is already stored somewhere in the standard context, the problem is to be 
notified that we are working on a particular thread and completely initialize 
all the contexts (OWB, jndi, tx, security)

thanks
david jencks

On Jan 19, 2011, at 2:49 AM, Rick McGuire wrote:

> On 1/19/2011 4:17 AM, Ivan wrote:
>> Hi,
>> From Tomcat 7.0.6, a different thread is used for listener start, filter 
>> start, and loadOnStartup, the purpose for that is for avoiding potential 
>> memory leaking. But we got problems for OWB initialization, as we register a 
>> OWB listener in the context. I am not sure whether this issue is a common 
>> issue, but so far, I could only see that OWB is affected. Now, my idea is to 
>> save the webbeans context in the servlet context, then attach it with the 
>> thread in WebBeansConfigurationListener. Part of those codes are like :
>> --->
>> WebBeansContext oldWebBeansContext = 
>> GeronimoSingletonService.contextEntered((WebBeansContext)event.getServletContext().getAttribute("org.apache.webbeans.config.WebBeansContext"));
>>        try {
>>            this.webBeansContext = WebBeansContext.getInstance();
>>            this.failoverService = 
>> webBeansContext.getService(FailOverService.class);
>>            //                this.lifeCycle.startApplication(event);
>>            
>> event.getServletContext().setAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION,
>>  "true");
>>        } catch (Exception e) {
>>            logger.error(OWBLogConst.ERROR_0018, 
>> event.getServletContext().getContextPath());
>>            WebBeansUtil.throwRuntimeExceptions(e);
>>        } finally {
>>            GeronimoSingletonService.contextExited(oldWebBeansContext);
>>        }
>> <---
>> 
>> Not sure that there is a common solution for it. Thoughts ?
> 
> Saving the information needed by the listener in the servlet context seems 
> like a much cleaner solution than relying on the thread context.  If this is 
> the only piece that is an issue, I'd go with the simple solution.  If there 
> are other contexts that need to be accessed, then I think these should be 
> wrappered in a single Geronimo context object that would be anchored in the 
> servlet context.
> 
> Rick
> 
> 
>> Thanks.
>> -- 
>> Ivan
> 

Reply via email to