[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-802) IndexControlMBeanTest fails with NPE because Hibernate Core closes the JNDI context

Hardy Ferentschik (JIRA) noreply at atlassian.com
Fri Aug 12 09:24:03 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43222#comment-43222 ] 

Hardy Ferentschik commented on HSEARCH-802:
-------------------------------------------

There is actually a shared moded (set by hibernate.jndi.org.osjava.sj.jndi.shared = true) which uses a static hashmap to share state. The problem is that the _AbstractContext#close_ implementation of simple-jndi removed all bound instances. The latest implementation of Hibernate Core's _JndiService_ calls the _close_ method in its finally block (probably has not done this before) in order to clean up resources.
The question is what the real intention of _javax.naming.Context#close()_ is. The docs are arguably vague. For now I use a custom _MemoryContext_ in the test which does a noop on _close()_.
See also http://code.google.com/p/osjava/issues/detail?id=12 and http://stackoverflow.com/questions/5120961/context-and-initialcontext-should-i-be-calling-the-close-method-on-these-obje 

> IndexControlMBeanTest fails with NPE because Hibernate Core closes the JNDI context
> -----------------------------------------------------------------------------------
>
>                 Key: HSEARCH-802
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-802
>             Project: Hibernate Search
>          Issue Type: Bug
>            Reporter: Emmanuel Bernard
>            Assignee: Hardy Ferentschik
>             Fix For: 4.0.0.Alpha1
>
>
> (first analysis)
> The library used to simulate JNDI seems to be purely in memory and do not have the notion of singleton.
> Therefore, the SessionFactory is bound to the JNDI context but the context is discarded. 
> When later the IndexController tries to reach the SessionFActory via JNDI, it creates a new context instead of sharing one with Hibernate Core.
> => investigate further and fix

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list